Example #1
0
        ///<summary> Update the limit tracker with the appropriate value for the Limit type. </summary>
        public void UpdateLimit(float damageValue)
        {
            if (limitType == DamageLimit.NONE)
            {
                return;
            }

            if (limitType == DamageLimit.DAMAGE_LIMIT && damageValue < 0)
            {
                limit.UpdateTimer(damageValue);
            }

            else if (limitType == DamageLimit.ATTACK_LIMIT)
            {
                limit.UpdateTimer(1);
            }

            if (removeOnLimitReached && limit.belowZero)
            {
                removeEffect = true;
            }
        }
Example #2
0
        ///<summary> Updates destroy based on the condition chosen in the inspector. </summary>
        public void UpdateInfo(float hitPoints)
        {
            if (condition == DestroyCondition.TIMER_ZERO)
            {
                limit.UpdateTimer();
                destroy = (limit.belowZero);
            }

            else if (condition == DestroyCondition.ZERO_HITPOINTS && hitPoints == 0)
            {
                destroy = true;
            }
        }
        ///<summary> Updates Effect limit, checks to see if DamageInfo can attack, updates AppearanceInfo. Flags effect for removal when the conditions for it are met. </summary>
        public void UpdateOutput(EnvironEffectList effects, ref float hitPoints, ResistanceInfo resistances)
        {
            if (endOnCondition == TerminalCondition.TIMER_ZERO)
            {
                limit.UpdateTimer();
                effects.ConditionalFlagForRemoval(limit.belowZero, this);
            }

            if (damageI)
            {
                damageI.Attack(ref hitPoints, resistances);
                effects.ConditionalFlagForRemoval(damageI.removeEffect, this);
            }

            if (appearanceI)
            {
                appearanceI.UpdateInfo();
            }
        }
Example #4
0
        ///<summary> Updates several timers, returns true if an attack can be made. </summary>
        private bool CanAttack()
        {
            delay.UpdateTimer();                        //Attacks can only be made when delay has timed out, attack gap has timed out,
            if (delay.belowZero)                        //and limit is still above zero
            {
                attackGap.UpdateTimer();
                if (limitType == DamageLimit.TIME_LIMIT)
                {
                    limit.UpdateTimer();
                }
            }

            if (attackGap.belowZero)
            {
                attackGap.ResetTimer();
                if (limit.aboveZero)
                {
                    return(true);
                }
            }

            return(false);
        }