Beispiel #1
0
 void OnTriggerEnter(Collider other)
 {
     if (other.CompareTag("Player"))
     {
         other.GetComponentInParent <PlayerController>().Destroy();
         Destroy(gameObject);
     }
     else if (other.CompareTag("Base"))
     {
         GameObject playerBase = other.gameObject;
         BaseHealth baseHealth = playerBase.GetComponent <BaseHealth>();
         baseHealth.ReduceHealth();
         Destroy(gameObject);
     }
 }