Example #1
0
    private void OnTriggerEnter2D(Collider2D other)
    {
        IDamageReceiver receiver = other.GetComponent <IDamageReceiver>();

        if (receiver != null)
        {
            if (receiver.OnDamage(hitTarget))
            {
                Destroy(gameObject);
            }
        }
    }
Example #2
0
        public virtual void ProcessAttack(AttackData attackData)
        {
            IDamageReceiver damageReceiver = attackData.target as IDamageReceiver;

            if (damageReceiver != null)
            {
                damageReceiver.OnDamage(attackData);
            }
            else
            {
                if (attackData.target.HasMethod(attackData.method))
                {
                    attackData.target.Call(attackData.method, attackData);
                }
            }
        }
Example #3
0
        public virtual void ProcessAttack(AttackData attackData)
        {
            IDamageReceiver damageReceiver = attackData.target as IDamageReceiver;

            damageReceiver.OnDamage(attackData);
        }