public void OnStopConditionChange(int value) { switch (stopConditionDropdown.captionText.text) { case "ValueEdited": stopCondition = () => valueInput.text != startValue; break; case "StopConditionChanged": stopCondition = () => stopConditionDropdown.captionText.text != startStopCondition; break; case "SecondPassedChanged": stopCondition = () => onSecondsPassedDropdown.captionText.text != startOnSecondsPassed; break; } }
/// <summary> /// Creates a new instance of a conditinal stat modifier using a conditional modifier info scriptable object /// </summary> public ConditionalStatModifier(ConditionalModifierInfoSO info) { name = info.name; valuePerSecond = info.Value; increase = info.Increase; modifiesCurrent = info.ModifiesCurrent; modifiesCurrentWithMax = info.ModifiesCurrentWithMax; canStack = info.CanStack; StopCondition = info.StopCondition ?? DefaultCondition; OnSecondPassedEvent = info.OnSecondsPassed; }
/// <summary>Sets given condition as to when to stop this modifier</summary> public ConditionalStatModifier ModifyUntil(ModificationEndCondition stopCondition) { StopCondition = stopCondition; return(this); }