Exemple #1
0
 private void HitGround(RaycastHit2D hit)
 {
     if (hit.transform.tag == "Ground" || hit.transform.tag == "Obstacles" || hit.transform.tag == "HitFromBelow")
     {
         isGrounded = true;
     }
     else if (hit.transform.tag == "Goomba")
     {
         Goomba goomba = hit.transform.GetComponent <Goomba>();
         if (goomba.isAlive)
         {
             rb.velocity = new Vector2(rb.velocity.x, 0f);
             rb.AddForce(new Vector2(0f, jumpHeight * enemyBounce), ForceMode2D.Impulse);
             goomba.Die();
         }
     }
     else
     {
         isGrounded = false;
     }
 }