예제 #1
0
    void FixedUpdate()
    {
        int dir = (_controller.FacingRight()) ? 1 : -1;

        switch (_controller.GetState())
        {
        case PlayerStateEnum.TestMove:
        case PlayerStateEnum.TestAirborneMove:
            _rb.AddRelativeForce(transform.right * Constants.BASE_MOVE_SPEED * dir);
            break;

        case PlayerStateEnum.TestJump:
            if (CollisionCommon.IsGrounded(gameObject))
            {
                _rb.AddRelativeForce(transform.up * Constants.BASE_JUMP_SPEED);
            }
            break;

        case PlayerStateEnum.TestRoll:
            _rb.AddRelativeForce(transform.right * Constants.BASE_ROLL_SPEED * dir);
            break;
        }
    }
예제 #2
0
 void FixedUpdate()
 {
     _current.enabled = false;
     _current         = _colliders[_controller.GetState()];
     _current.enabled = true;
 }