Beispiel #1
0
    private void OnTriggerEnter(Collider other)
    {
        GameObject target = other.gameObject;

        if (other.tag == "Attachment")
        {
            AttachmentBase a = other.GetComponent <AttachmentBase>();

            target = a.parent.gameObject;
            if (target.tag == "Enemy")
            {
                MobBase mob = other.GetComponent <MobBase>();
                mob.Damage(damage);
            }

            if (target.tag != "Player")
            {
                Destroy(gameObject);
            }
        }

        if (other.tag == "Enemy")
        {
            MobBase mob = other.GetComponent <MobBase>();
            mob.Damage(damage);
        }

        if (other.tag != "Player")
        {
            Destroy(gameObject);
        }
    }