/Engine/Game/BaseProcess.cs
C# | 44 lines | 21 code | 3 blank | 20 comment | 0 complexity | d6840e457cf46f00f818dfdeecc618e7 MD5 | raw file
Possible License(s): Apache-2.0
- namespace Delta.Engine.Game
- {
- /// <summary>
- /// Base class for all processes, defines what all processes can do.
- /// Basically they all have a Run method and can be active (then Run is
- /// called) or not (then they needed to be activated).
- /// </summary>
- public abstract class BaseProcess
- {
- #region IsActive (Public)
- /// <summary>
- /// Is this process active? Run is only called if this is true, inactive
- /// processes just sit there waiting to be killed or re-activated.
- /// </summary>
- public bool IsActive = true;
- #endregion
-
- #region Next (Public)
- /// <summary>
- /// Next process if this one is finished. Automatically made active if
- /// this process ends (once Run returns true).
- /// </summary>
- public BaseProcess Next;
- #endregion
-
- #region Constructors
- /// <summary>
- /// Initializes a new instance of the <see cref="BaseProcess"/> class.
- /// </summary>
- public BaseProcess()
- {
- ProcessManager.Instance.processes.Add(this);
- }
- #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 abstract bool Run();
- #endregion
- }
- }