Пример #1
0
 void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Attacker")
     {
         AttackerHealth attackerHealth = other.GetComponent <AttackerHealth>();
         if (attackerHealth != null)
         {
             attackerHealth.DealDamage();
             Destroy(gameObject);
         }
     }
 }
Пример #2
0
    public void strikeCurrentInvader(float damage)
    {
        if (!currentInvaderTarget)
        {
            return;
        }

        AttackerHealth health = currentInvaderTarget.GetComponent <AttackerHealth>();

        if (health)
        {
            health.DealDamage(damage);
        }
    }