new void FixedUpdate()
 {
     if (_groundedState.IsGrounded())
     {
         base.FixedUpdate();
     }
 }
예제 #2
0
    private void Jump(float thrust)
    {
        if (!_jumped)
        {
            if (_groundedState.IsGrounded())
            {
                //TODO Make this if an option
                //if (_rb.velocity.y > 0) return;

                //if (_rb.velocity.y < thrust)
                //{
                _rb.velocity += new Vector2(0, thrust);
                if (_rb.velocity.y > thrust)
                {
                    _rb.velocity = new Vector2(_rb.velocity.x, thrust);
                }
                //}
                StartCoroutine(JumpedCoroutine());
            }
        }
    }
예제 #3
0
    void FixedUpdate()
    {
        if (_groundedState.IsGrounded())
        {
            return;
        }
        if (_rb.velocity.y < -terminalVelocity)
        {
            return;
        }

        if (_rb.velocity.y > -terminalVelocity)
        {
            _rb.velocity -= new Vector2(0, gravity);
        }
        if (_rb.velocity.y < -terminalVelocity)
        {
            _rb.velocity = new Vector2(_rb.velocity.x, -terminalVelocity);
        }
    }