Exemple #1
0
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        Enemy_Skeleton orc = hitInfo.GetComponent <Enemy_Skeleton>();

        if (orc != null)
        {
            orc.TakeDamage(dmg);
        }

        Destroy(gameObject);
    }
    void OnTriggerEnter2D(Collider2D hitInfo)
    {
        if (hitInfo.tag == "Object")
        {
            Obj_Box hit_box = hitInfo.GetComponent <Obj_Box>();
            if (hit_box != null)
            {
                hit_box.TakeDamage(damage);
            }
        }

        if (hitInfo.tag == "Enemy")
        {
            Enemy_Skeleton hit_enemy = hitInfo.GetComponent <Enemy_Skeleton>();
            if (hit_enemy != null)
            {
                hit_enemy.TakeDamage(damage);
            }
        }
    }