示例#1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "Ammo Bonus")
     {
         PlayerShooting playerShooting = GetComponentInChildren <PlayerShooting>();
         AmmoBonus      ammoBonus      = other.GetComponent <AmmoBonus>();
         playerShooting.AddAmmo(ammoBonus.ammoAmount);
         ammoBonus.DestroyBonus();
     }
 }
示例#2
0
 public void OnTriggerEnter(Collider other)
 {
     if (other.gameObject.CompareTag("Ammo"))
     {
         if (playerShooting.AddAmmo())
         {
             Destroy(other.gameObject);
         }
     }
     else if (other.gameObject.CompareTag("Health"))
     {
         if (playerHealth.AddHealth(other.gameObject.GetComponent <Health>().value))
         {
             Destroy(other.gameObject);
         }
     }
 }