Esempio n. 1
0
    // Stores the functions triggered by "JumpAndMovement"
    #region MovementFunctions

    // Jumping while not grounded reduces "jumps left"
    void Jump()
    {
        if (grounded)
        {
            // Do nothing.
        }
        else if (airJumpsLeft > 0 && !grounded)
        {
            airJumpsLeft--;
        }
        else
        {
            return;
        }

        GetComponent <Rigidbody2D>().velocity = new Vector2(GetComponent <Rigidbody2D>().velocity.x, jumpHeight);
        particle.JumpParticleRelease(this);
    }