Beispiel #1
0
    void FixedUpdate()
    {
        if (this.Body.velocity.y == 0.0f)
        {
            Player.GetComponent <ADSRManager>().SetGrounded(true);
            playerAudio.JumpLand();

            // fixed bug where releasing horizontal movement during a jump would cause the player to keep sliding once landed
            if (ADSR.GetPhase() == ADSRManager.Phase.Sustain && !Input.GetButton("Horizontal"))
            {
                ADSR.SetPhase(ADSRManager.Phase.Release);
                ADSR.SetDirection(ADSRManager.Direction.None);
            }
        }
        else if (this.Body.velocity.y != 0.0f)
        {
            ADSR.SetGrounded(false);
        }
    }