namespace Zinnia.Event.Yield { using System.Collections; using UnityEngine; using Zinnia.Extension; /// /// Yields after the have passed in unscaled time. /// public class WaitForSecondsRealtimeYieldEmitter : YieldEmitter { [Tooltip("The number of seconds to wait in unscaled time before yielding.")] [SerializeField] private float secondsToWait; /// /// The number of seconds to wait in unscaled time before yielding. /// public float SecondsToWait { get { return secondsToWait; } set { secondsToWait = value; if (this.IsMemberChangeAllowed()) { OnAfterSecondsToWaitChange(); } } } /// /// The instruction to yield upon. /// protected WaitForSecondsRealtime yieldInstruction; /// protected override IEnumerator YieldOn() { yield return yieldInstruction; } protected virtual void OnEnable() { OnAfterSecondsToWaitChange(); } /// /// Called after has been changed. /// protected virtual void OnAfterSecondsToWaitChange() { yieldInstruction = new WaitForSecondsRealtime(SecondsToWait); } } }