public void AddNewTimer(ITimeEventable timeEventable) { if (!timers.ContainsKey(timeEventable.TimerKey)) { timers.Add(timeEventable.TimerKey, timeEventable.ITimeEventCoroutine()); StartCoroutine(timeEventable.ITimeEventCoroutine()); } }
public void RemoveTimer(ITimeEventable timeEventable) { IEnumerator timer = timers[timeEventable.TimerKey]; if (timer == null) { Debug.LogError($"TimeEventsHandler doesn't have timer with key: {timeEventable.TimerKey}"); } else { StopCoroutine(timer); timers.Remove(timeEventable.TimerKey); } }