Пример #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Attacker attacker = collision.gameObject.GetComponent <Attacker>();
        health   healh    = collision.gameObject.GetComponent <health>();

        if (attacker && healh)
        {
            healh.DealDamage(damage);
            Destroy(gameObject);
        }
    }
Пример #2
0
 // Called from the animator at the time of the actual blow
 void StrikeCurrentTarget(float damage)
 {
     if (currentTarget)
     {
         //Debug.Log(name + " dealt" + damage + " damage");
         health hp = currentTarget.GetComponent <health>();
         if (hp)
         {
             hp.DealDamage(damage);
         }
     }
 }
Пример #3
0
    public void StrikeCurrentTarget(float damage)
    {
        if (!currentTarget)
        {
            return;
        }

        health Health = currentTarget.GetComponent <health>();

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