/// <summary> /// Stops the given timed action; preventing the event from being called /// </summary> /// <param name="action">The timed action to stop</param> /// <returns>False if the action is not in the list of actions</returns> public bool StopTimedAction(TimedAction action) { if (action == null) { return(false); } action.Disable(); return(_timedActions.Remove(action)); }
private void TryInvokeTimedEvent(float time, int index) { TimedAction action = _timedActions[index]; if (time - action.TimeStarted >= action.Duration && action.GetEnabled()) { action.Disable(); action.Event.Invoke(); _timedActions.Remove(action); } }