/// <summary> /// Starts the service. This method should be called from constructor of inheriting class. /// </summary> /// <param name="delay">Delay value in frames or seconds</param> /// <param name="type">Deferred service type</param> protected void SetupAndStart(float delay, DeferredType type) { _delay = delay; _delayDefined = delay; _type = type; Start(); }
/// <summary> /// Initializes a new instance of the DeferredSignal class with specified sinal name and delay. /// </summary> /// <param name="signal">Signal name that will be dispatched with delay</param> /// <param name="delay">Delay value in frames or seconds</param> /// <param name="type">Delay type</param> public DeferredSignal(string signal, float delay = 0, DeferredType type = DeferredType.FramesBased) { _signalName = signal; SetupAndStart(delay, type); }
/// <summary> /// Initializes a new instance of the DeferredAction class with specified callback and delay. /// </summary> /// <param name="callback">Callback that will be executed with delay</param> /// <param name="delay">Delay value in frames or seconds</param> /// <param name="type">Deferred action type</param> public DeferredAction(Action callback, float delay = 0, DeferredType type = DeferredType.FramesBased) { _callback = callback; SetupAndStart(delay, type); }