Beispiel #1
0
 private void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Obstacle"))
     {
         if (IsMovingRight)
         {
             CanMoveRight = false;
         }
         else
         {
             CanMoveLeft = false;
         }
     }
     else if (other.gameObject.CompareTag("Deadly"))
     {
         Lose();
     }
     else if (other.gameObject.CompareTag("Collectible"))
     {
         Collectible collectible = other.gameObject.GetComponent <Collectible>();
         if (!collectible.IsCollected)
         {
             scoreManager.AddGemToScore(collectible.GetGemType());
         }
     }
 }