Adapted movement controller to work with master
This commit is contained in:
		@@ -2725,6 +2725,18 @@ PrefabInstance:
 | 
			
		||||
      propertyPath: m_camera
 | 
			
		||||
      value: 
 | 
			
		||||
      objectReference: {fileID: 519420031}
 | 
			
		||||
    - target: {fileID: 5559747613460074786, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
			
		||||
      propertyPath: Data
 | 
			
		||||
      value: 
 | 
			
		||||
      objectReference: {fileID: 11400000, guid: fec218a9d55267dedac6ebe31eab6dcd, type: 2}
 | 
			
		||||
    - target: {fileID: 5559747613460074786, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
			
		||||
      propertyPath: _groundCheckSize.y
 | 
			
		||||
      value: 0.93
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 5559747613460074786, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
			
		||||
      propertyPath: _groundLayer.m_Bits
 | 
			
		||||
      value: 64
 | 
			
		||||
      objectReference: {fileID: 0}
 | 
			
		||||
    - target: {fileID: 5885597207104481986, guid: 576d3fc87874f426294e4bbacb171478, type: 3}
 | 
			
		||||
      propertyPath: m_RootOrder
 | 
			
		||||
      value: 9
 | 
			
		||||
 
 | 
			
		||||
@@ -43,12 +43,9 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
 | 
			
		||||
    //Set all of these up in the inspector
 | 
			
		||||
    [Header("Checks")]
 | 
			
		||||
    [SerializeField] private Transform _groundCheckPoint;
 | 
			
		||||
    //Size of groundCheck depends on the size of your character generally you want them slightly small than width (for ground) and height (for the wall check)
 | 
			
		||||
    [SerializeField] private Vector2 _groundCheckSize = new Vector2(0.49f, 0.03f);
 | 
			
		||||
    [Space(5)]
 | 
			
		||||
    [SerializeField] private Transform _frontWallCheckPoint;
 | 
			
		||||
    [SerializeField] private Transform _backWallCheckPoint;
 | 
			
		||||
    [SerializeField] private Vector2 _wallCheckSize = new Vector2(0.5f, 1f);
 | 
			
		||||
 | 
			
		||||
    [Header("Layers & Tags")]
 | 
			
		||||
@@ -97,19 +94,19 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
        if (!IsJumping)
 | 
			
		||||
        {
 | 
			
		||||
            //Ground Check
 | 
			
		||||
            if (Physics2D.OverlapBox(_groundCheckPoint.position, _groundCheckSize, 0, _groundLayer) && !IsJumping) //checks if set box overlaps with ground
 | 
			
		||||
            if (Physics2D.OverlapBox(this.transform.position, _groundCheckSize, 0, _groundLayer) && !IsJumping) //checks if set box overlaps with ground
 | 
			
		||||
            {
 | 
			
		||||
                LastOnGroundTime = Data.coyoteTime; //if so sets the lastGrounded to coyoteTime
 | 
			
		||||
            }
 | 
			
		||||
 | 
			
		||||
            //Right Wall Check
 | 
			
		||||
            if (((Physics2D.OverlapBox(_frontWallCheckPoint.position, _wallCheckSize, 0, _groundLayer) && IsFacingRight)
 | 
			
		||||
                    || (Physics2D.OverlapBox(_backWallCheckPoint.position, _wallCheckSize, 0, _groundLayer) && !IsFacingRight)) && !IsWallJumping)
 | 
			
		||||
            if (((Physics2D.OverlapBox(this.transform.position, _wallCheckSize, 0, _groundLayer) && IsFacingRight)
 | 
			
		||||
                    || (Physics2D.OverlapBox(this.transform.position, _wallCheckSize, 0, _groundLayer) && !IsFacingRight)) && !IsWallJumping)
 | 
			
		||||
                LastOnWallRightTime = Data.coyoteTime;
 | 
			
		||||
 | 
			
		||||
            //Right Wall Check
 | 
			
		||||
            if (((Physics2D.OverlapBox(_frontWallCheckPoint.position, _wallCheckSize, 0, _groundLayer) && !IsFacingRight)
 | 
			
		||||
                || (Physics2D.OverlapBox(_backWallCheckPoint.position, _wallCheckSize, 0, _groundLayer) && IsFacingRight)) && !IsWallJumping)
 | 
			
		||||
            if (((Physics2D.OverlapBox(this.transform.position, _wallCheckSize, 0, _groundLayer) && !IsFacingRight)
 | 
			
		||||
                || (Physics2D.OverlapBox(this.transform.position, _wallCheckSize, 0, _groundLayer) && IsFacingRight)) && !IsWallJumping)
 | 
			
		||||
                LastOnWallLeftTime = Data.coyoteTime;
 | 
			
		||||
 | 
			
		||||
            //Two checks needed for both left and right walls since whenever the play turns the wall checkPoints swap sides
 | 
			
		||||
@@ -409,10 +406,10 @@ public class PlayerMovement : MonoBehaviour
 | 
			
		||||
    private void OnDrawGizmosSelected()
 | 
			
		||||
    {
 | 
			
		||||
        Gizmos.color = Color.green;
 | 
			
		||||
        Gizmos.DrawWireCube(_groundCheckPoint.position, _groundCheckSize);
 | 
			
		||||
        Gizmos.DrawWireCube(this.transform.position, _groundCheckSize);
 | 
			
		||||
        Gizmos.color = Color.blue;
 | 
			
		||||
        Gizmos.DrawWireCube(_frontWallCheckPoint.position, _wallCheckSize);
 | 
			
		||||
        Gizmos.DrawWireCube(_backWallCheckPoint.position, _wallCheckSize);
 | 
			
		||||
        Gizmos.DrawWireCube(this.transform.position, _wallCheckSize);
 | 
			
		||||
        Gizmos.DrawWireCube(this.transform.position, _wallCheckSize);
 | 
			
		||||
    }
 | 
			
		||||
    #endregion
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user