Пример #1
0
 // If the player walks into a HealthPickUp, heal the player and destroy the HealthPickUp.
 private void OnTriggerEnter(Collider other)
 {
     if (other.GetComponent <Collider>().tag == "Player" && !other.GetComponent <PlayerDamage>().HasMaxHealth())
     {
         Debug.Log("old health: " + playerHealth.health);
         playerHealth.HealPlayer(healthAmt);
         Debug.Log("new health: " + playerHealth.health);
         Destroy(this.gameObject);
     }
 }