/// <summary> /// Creates a TimeContainer and adds it to the active timers list /// </summary> /// <param name="_Trigger">Event to trigger</param> /// <param name="_Delay">Time until trigger</param> /// <param name="_Loop">Loops the timer</param> /// <param name="_Linked">Linked Object</param> /// <param name="_Tick">Event call on each tick</param> /// <param name="_TickTime">Time between ticks</param> /// <param name="_Start">Event on timer start</param> /// <param name="_delayedStart">Time to wait before starting timer</param> /// <returns></returns> public static TimeContainer AddDelegate(onFinishedReturn _Trigger = null, float _Delay = 1, bool _Loop = false, object _Linked = null, Tick _Tick = null, float _TickTime = 0, Start _Start = null, float _delayedStart = 0) { TimeContainer TimeDelegate = new TimeContainer(_Start, _Tick, _Trigger, _Linked, _Delay, _Loop, _TickTime, _delayedStart); Instance.ActiveTimecontainersList.Add(TimeDelegate); if (_delayedStart > 0) { TimeDelegate.isPaused = true; AddDelegate((object o) => { if (_Start != null) { _Start(); } TimeDelegate.isPaused = false; }, _delayedStart); } else if (_Start != null) { _Start(); } return(TimeDelegate); }
public void ClearValues() { TickTimer = 0; deltaTime = 0; isPaused = false; RemoveNext = false; OnStart = null; OnTick = null; OnTrigger = null; LinkedObject = null; }
public TimeContainer(Start _Start = null, Tick _Tick = null, onFinishedReturn _Trigger = null, object _Linked = null, float _Delay = 1, bool _Loop = false, float _TickTime = 0, float _delayedStart = 0) { OnStart = _Start; OnTick = _Tick; OnTrigger = _Trigger; isLooping = _Loop; WaitTime = _Delay; Timer = 0; LinkedObject = _Linked; TickTimeDelay = _TickTime; DelayedStart = _delayedStart; procentsFinished = 0; StepSize = 0; }