/Engine/Game/WaitProcess.cs
C# | 44 lines | 23 code | 2 blank | 19 comment | 0 complexity | feb34655e3c760de5fe1a119dce4d2dd MD5 | raw file
Possible License(s): Apache-2.0
1namespace Delta.Engine.Game 2{ 3 /// <summary> 4 /// Simple process running as long as the wait time isn't exceeded. 5 /// </summary> 6 public class WaitProcess : BaseProcess 7 { 8 #region WaitTime (Public) 9 /// <summary> 10 /// How long to wait until this process is done, can be changed at any 11 /// time. When this reaches 0, this process is killed and the next is 12 /// invoked automatically. 13 /// </summary> 14 public float WaitTime; 15 #endregion 16 17 #region Constructors 18 /// <summary> 19 /// Create wait process and execute a certain process after the wait time 20 /// is over. 21 /// </summary> 22 /// <param name="setWaitTime">How long to wait in seconds</param> 23 /// <param name="setNextProcess">The next process to be executed once the 24 /// wait time is over</param> 25 public WaitProcess(float setWaitTime, BaseProcess setNextProcess) 26 { 27 WaitTime = setWaitTime; 28 Next = setNextProcess; 29 } 30 #endregion 31 32 #region Run (Public) 33 /// <summary> 34 /// Run is called for all active processes by the ProcessManager each tick 35 /// </summary> 36 /// <returns>True if the process finished, otherwise false.</returns> 37 public override bool Run() 38 { 39 WaitTime -= Time.Delta; 40 return WaitTime <= 0; 41 } 42 #endregion 43 } 44}