예제 #1
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.GetComponent <Attackers>())
        {
            Attackers attackers = collision.gameObject.GetComponent <Attackers>();
            Health    health    = attackers.GetComponent <Health>();

            if (attackers && health)
            {
                health.DealDamage(damage);
                Destroy(gameObject);
            }
        }
    }