private void OnTriggerEnter2D(Collider2D collision)
    {
        Attacker attacker = collision.gameObject.GetComponent <Attacker>();

        if (attacker)
        {
            healthDisplay.DealDamage(attacker.GetAttackDamage());
            Destroy(attacker.gameObject);
        }
    }
Пример #2
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        GameObject otherObject = collision.gameObject;

        if (otherObject.GetComponent <Attacker>())
        {
            HealthDisplay healthDisplay = FindObjectOfType <HealthDisplay>();
            healthDisplay.DealDamage(defaultDamage);
            Destroy(otherObject);
        }
    }
Пример #3
0
 void OnTriggerEnter2D(Collider2D collider)
 {
     healthDisplay.DealDamage();
 }