コード例 #1
0
    public void OnTriggerEnter(Collider other)
    {
        BaseHealth health = other.GetComponentInParent <BaseHealth> ();

        if (health != null)
        {
            Debug.Log("Killing " + other.gameObject.name);
            health.KillSelf();
        }
    }
コード例 #2
0
 private void SelfDestruct()
 {
     if (myHealth == null)
     {
         if (poolable == null)
         {
             Destroy(gameObject);
         }
         else
         {
             poolable.ReturnToPool();
         }
     }
     else
     {
         myHealth.KillSelf();
     }
 }