Beispiel #1
0
    void DamageCreature(Collision2D col)
    {
        if (obeyCreatureNoDamage && col.otherCollider.CompareTag("CreatureNoDamage"))
        {
            return;
        }

        ICreature creatureHit = col.gameObject.GetComponent <ICreature>();

        if (creatureHit == null)
        {
            creatureHit = col.gameObject.GetComponentInParent <ICreature>();
        }

        if (creatureHit != null && creatureHit.CanBeDamaged(myCreature.damageLayer))
        {
            creatureHit.Damage(damage, col.contacts[0].point);
        }
    }