public bool HasModifier(string modifierName, out ReputationModifier repMod) { repMod = null; for (int i = 0; i < Modifiers.Count; i++) { if (Modifiers[i].Name == modifierName) { repMod = Modifiers[i]; break; } } return(repMod != null); }
public void AddModifier(ReputationModifier repMod) { RefreshRepModifiers(); //remove all existing modifiers that match this one //Debug.Log ("Adding rep modifier " + repMod.Name); for (int i = Modifiers.LastIndex(); i >= 0; i--) { if (Modifiers[i].Name == repMod.Name || Modifiers[i] == repMod) { Modifiers.RemoveAt(i); } } //insert the new mod at the head of the list Modifiers.Insert(0, repMod); //this will reset its effects repMod.TimeAdded = WorldClock.AdjustedRealTime; }