Пример #1
0
    protected virtual void OnTriggerEnter(Collider other)
    {
        if (m_ParentActorAttachedTo.GetComponent <Patch>() != null)
        {
            //Debug.Log("############ Patched ....");
        }
        if (Enabled == true && m_ParentActorAttachedTo != null && !JustSpawned)
        {
            Defender defender = other.gameObject.GetComponent <Defender>();
            if (defender != null && !defender.JustSpawned)
            {
                Actor defenderActor = defender.ParentActorAttachedTo;

                if (m_ParentActorAttachedTo.GetComponent <Patch>() != null)
                {
                    //Debug.Log("############ Patched ....");
                }

                if (defenderActor != null && defenderActor != m_ParentActorAttachedTo && defender.CanAttack(m_ParentActorAttachedTo) == true)
                {
                    if (m_ParentActorAttachedTo.GetComponent <Patch>() != null)
                    {
                        //Debug.Log("############ Patched Inside.......");
                    }
                    //Debug.Log("Try attack..");
                    if (defender.Attacked(m_ParentActorAttachedTo, m_AttackDamage) == false)
                    {
                        CurrentAttackBlocked(defenderActor);
                    }
                    else
                    {
                        m_ThisFrameAttacked = true;
                        CurrentAttackSuccedded(defenderActor);
                    }
                }
            }
        }
    }