예제 #1
0
    private void FixedUpdate()
    {
        //Checks if the player pressed the jump button before applying the jump
        if (jumped || doubleJumped)
        {
            jump();
            numberOfJumps--;
            jumped = false;

            if (doubleJumped)
            {
                doubleJumped = false;
            }
        }

        if (status.getTechyBounce())
        {
            techyBounce();
            status.setTechyBounce(false);
        }

        //Increases gravity when player is falling. Also accounts for when the player only holds jump for a short time
        if (rb.velocity.y < 0)
        {
            rb.velocity += Vector2.up * Physics2D.gravity.y * (fallMultiplier - 1) * Time.deltaTime;
        }
        else if (rb.velocity.y > 0 && !Input.GetButton("Jump"))
        {
            rb.velocity += Vector2.up * Physics2D.gravity.y * (lowJumpMultiplier - 1) * Time.deltaTime;
        }
    }
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Techy" && status.getPounding())
     {
         Debug.Log("Bouncing on turtle");
         status.setTechyBounce(true);
     }
 }