void Start() { reduceEnergyDebuff = combatant.StatusEffectManager.AddEffect(new MovingReduceEnergy(combatant)); if (target.transform.position.x < this.transform.position.x) combatant.DirectionFaced = "Left"; else combatant.DirectionFaced = "Right"; }
// Checks the effect that is to be applied. If this combatant is already affected by this type of status, we return that instance // of it from the collection. Otherwise, we return the status to be applied. private bool CheckForEffect(StatusEffect statusToApply, out StatusEffect status) { foreach(StatusEffect s in statusEffects) { if(s.GetType() == statusToApply.GetType()) { status = s; return true; } } status = null; return false; }
public StatusEffect AddEffect(StatusEffect statusToApply) { StatusEffect existingStatus = null; if(CheckForEffect(statusToApply, out existingStatus)) { existingStatus.Refresh(); } else { statusEffects.Add(statusToApply); } Recalculate(); if (existingStatus == null) return statusToApply; else return existingStatus; }
public StatusEffect AddEffect(StatusEffect statusToApply) { StatusEffect existingStatus = null; if (CheckForEffect(statusToApply, out existingStatus)) { existingStatus.Refresh(); } else { statusEffects.Add(statusToApply); } Recalculate(); if (existingStatus == null) { return(statusToApply); } else { return(existingStatus); } }
public void RemoveEffect(StatusEffect effect) { statusEffects.Remove(effect); Recalculate(); }
public void RemoveEffect(StatusEffect effect) { statusEffects.Remove(effect); Recalculate(); }