示例#1
0
 void OnTriggerEnter(Collider other)
 {
     if (tag == "Bullet")
     {
         if (other.tag == "Hostile")
         {
             Destroy(other.gameObject);
             Destroy(gameObject);
             Debug.Log(other.gameObject.name + " destroyed " + gameObject.name, this);
             score.AddKill();
         }
         else if (other.tag == "Friendly")
         {
             Destroy(other.gameObject);
             Destroy(gameObject);
             Debug.Log(other.gameObject.name + " destroyed " + gameObject.name, this);
             score.AddFriendKill();
         }
     }
     else if (tag == "Player")
     {
         if (other.tag == "Hostile" || other.tag == "HostileBullet" || other.tag == "Friendly")
         {
             game.Lose();
         }
         else if (other.tag == "Target")
         {
             game.Win();
         }
     }
 }