Пример #1
0
 void OnCollisionEnter(Collision col)
 {
     if (!broken)
     {
         if (col.gameObject.GetComponent <Enemy>() || col.gameObject.transform.parent != null && col.gameObject.transform.parent.GetComponent <Enemy>())
         {
             teleport.PrepareToTeleport(transform.position);
             Destroy(transform.gameObject);
         }
         else if (!col.gameObject.GetComponent <Player>())
         {
             broken = true;
         }
     }
 }