Пример #1
0
 public void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.tag == "Damage" && getSafeForm() == 0)
     {
         setHp(--hp);
         setSafeForm(maxSafeForm);
     }
     if (collision.gameObject.tag == "Exit")
     {
         sceneManager.NextScene();
     }
     if (collision.gameObject.CompareTag("Heart") && indexHeartPick == 0)
     {
         Destroy(collision.gameObject);
         setHp(hp + 1);
         indexHeartPick = 10;
     }
     if (collision.gameObject.CompareTag("Coin") && indexCoinPick == 0)
     {
         Destroy(collision.gameObject);
         setCoins(coins + 1);
         indexCoinPick = 10;
     }
     if (collision.gameObject.CompareTag("Button") && indexButtonStand == 0)
     {
         ButtonScript button = collision.gameObject.GetComponent <ButtonScript>();
         button.changeActive();
         indexButtonStand = 100;
     }
 }