Exemple #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Vegetation"))
     {
         m_Agent.IncrementEnergy(energyIncrementOnVegContact);
         other.GetComponent <GAVegetation>().Remove();
     }
     else if (other.CompareTag("Prey"))
     {
         m_Agent.IncrementEnergy(-energyDecrementOnPreyContact);
     }
 }
Exemple #2
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.CompareTag("Prey"))
     {
         m_Agent.IncrementEnergy(energyIncrementOnPreyContact);
         other.GetComponent <GAAgent> ().Kill();
     }
     else if (other.CompareTag("Predator"))
     {
         m_Agent.IncrementEnergy(-energyDecrementOnPredContact);
     }
 }