protected virtual void ApplyContinuousEffect(BaseAgent triggeringComponent, float timeStep) { int applicableEffect = 0; if (triggeringComponent != null) { switch (effectCode) { case EFFECT_CODE_HP_DAMAGE: accumulatedEffect += timeStep * effectIntensity; applicableEffect = (int)accumulatedEffect; if (applicableEffect > 0) { accumulatedEffect -= applicableEffect; triggeringComponent.SufferHPDamage(applicableEffect, gameObject, triggerSourceComponent); } break; case EFFECT_CODE_HP_RECOVERY: accumulatedEffect += timeStep * effectIntensity; applicableEffect = (int)accumulatedEffect; if (applicableEffect > 0) { accumulatedEffect -= applicableEffect; triggeringComponent.AddToCurrentHP(applicableEffect, false); } break; } } }
/*halmeida - this function receives an index that is valid across all relevant arrays and denotes * an element that is not null across all relevant arrays.*/ protected override void Trigger(int triggerIndex) { BaseAgent agentComponent = null; agentComponent = triggerComponents[triggerIndex]; if (!continuousEffect) { switch (effectCode) { case EFFECT_CODE_HP_DAMAGE: agentComponent.SufferHPDamage((int)effectIntensity, gameObject, triggerSourceComponent); break; case EFFECT_CODE_HP_RECOVERY: agentComponent.AddToCurrentHP((int)effectIntensity, false); break; } Deactivate(); } base.Trigger(triggerIndex); }