NPC.ApplyAttack C# (CSharp) Method

ApplyAttack() public method

Applies the attack to the NPC
public ApplyAttack ( int damage ) : bool
damage int Damage.
return bool
    public override bool ApplyAttack(int damage)
    {
        npc_hp=npc_hp-damage;
        return true;
    }

Same methods

NPC::ApplyAttack ( int damage, GameObject source ) : bool

Usage Example

Example #1
0
    void OnTriggerEnter(Collider other)
    {
        //Get the NPC that hit the ward
        NPC npc = other.gameObject.GetComponent <NPC>();

        if (npc != null)              //Has the collision hit an npc
        {
            spellprop.init(SpellEffect.UW1_Spell_Effect_RuneofWarding, UWCharacter.Instance.gameObject);
            if (spellprop.BaseDamage != 0)
            {
                npc.ApplyAttack(spellprop.BaseDamage);
            }
            spellprop.onImpact(npc.transform);
            spellprop.onHit(npc.gameObject.GetComponent <ObjectInteraction>());
            this.GetComponent <ObjectInteraction>().objectloaderinfo.InUseFlag = 0;
            Destroy(this.gameObject);
        }
        else
        {
            if (other.gameObject.GetComponent <UWCharacter>())
            {
                spellprop.onImpactPlayer();
            }
        }
    }
All Usage Examples Of NPC::ApplyAttack