Beispiel #1
0
    private void on_Jump()
    {
        switch (_state)
        {
        default:
            break;

        case State.IDLE:
        case State.MOVING:
        case State.RUNNING:
        case State.AGAINST_WALL:
        case State.CROUCHING:
            _state       = State.JUMP;
            _isFirstJump = true;
            Velocity.y   = JumpSpeed;
            break;

        case State.LANDING:
        case State.DYING:
            break;

        case State.JUMP:
        case State.FALLING:
            if (_isFirstJump || _controller.GetDistanceToGround() < JumpZone)
            {
                Velocity.y   = JumpSpeed;
                _isFirstJump = false;
                _state       = State.JUMP;
            }

            break;
        }
    }