/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
- namespace Delta.Engine.Game
- {
- /// <summary>
- /// Simple process running as long as the wait time isn't exceeded.
- /// </summary>
- public class WaitProcess : BaseProcess
- {
- #region WaitTime (Public)
- /// <summary>
- /// How long to wait until this process is done, can be changed at any
- /// time. When this reaches 0, this process is killed and the next is
- /// invoked automatically.
- /// </summary>
- public float WaitTime;
- #endregion
-
- #region Constructors
- /// <summary>
- /// Create wait process and execute a certain process after the wait time
- /// is over.
- /// </summary>
- /// <param name="setWaitTime">How long to wait in seconds</param>
- /// <param name="setNextProcess">The next process to be executed once the
- /// wait time is over</param>
- public WaitProcess(float setWaitTime, BaseProcess setNextProcess)
- {
- WaitTime = setWaitTime;
- Next = setNextProcess;
- }
- #endregion
-
- #region Run (Public)
- /// <summary>
- /// Run is called for all active processes by the ProcessManager each tick
- /// </summary>
- /// <returns>True if the process finished, otherwise false.</returns>
- public override bool Run()
- {
- WaitTime -= Time.Delta;
- return WaitTime <= 0;
- }
- #endregion
- }
- }