PageRenderTime 11ms CodeModel.GetById 6ms app.highlight 1ms RepoModel.GetById 1ms app.codeStats 0ms

/Engine/Game/BaseProcess.cs

#
C# | 44 lines | 21 code | 3 blank | 20 comment | 0 complexity | d6840e457cf46f00f818dfdeecc618e7 MD5 | raw file
 1namespace Delta.Engine.Game
 2{
 3	/// <summary>
 4	/// Base class for all processes, defines what all processes can do.
 5	/// Basically they all have a Run method and can be active (then Run is
 6	/// called) or not (then they needed to be activated).
 7	/// </summary>
 8	public abstract class BaseProcess
 9	{
10		#region IsActive (Public)
11		/// <summary>
12		/// Is this process active? Run is only called if this is true, inactive
13		/// processes just sit there waiting to be killed or re-activated.
14		/// </summary>
15		public bool IsActive = true;
16		#endregion
17
18		#region Next (Public)
19		/// <summary>
20		/// Next process if this one is finished. Automatically made active if
21		/// this process ends (once Run returns true).
22		/// </summary>
23		public BaseProcess Next;
24		#endregion
25
26		#region Constructors
27		/// <summary>
28		/// Initializes a new instance of the <see cref="BaseProcess"/> class.
29		/// </summary>
30		public BaseProcess()
31		{
32			ProcessManager.Instance.processes.Add(this);
33		}
34		#endregion
35
36		#region Run (Public)
37		/// <summary>
38		/// Run is called for all active processes by the ProcessManager each tick
39		/// </summary>
40		/// <returns>True if the process finished, otherwise false.</returns>
41		public abstract bool Run();
42		#endregion
43	}
44}