1 /*
2                                     __
3                                    / _|
4   __ _ _   _ _ __ ___  _ __ __ _  | |_ ___  ___ ___
5  / _` | | | | '__/ _ \| '__/ _` | |  _/ _ \/ __/ __|
6 | (_| | |_| | | | (_) | | | (_| | | || (_) \__ \__ \
7  \__,_|\__,_|_|  \___/|_|  \__,_| |_| \___/|___/___/
8 
9 Copyright (C) 2019-2020 Aurora Free Open Source Software.
10 Copyright (C) 2019 João Lourenço <joao@aurorafoss.org>
11 
12 This file is part of the Aurora Free Open Source Software. This
13 organization promote free and open source software that you can
14 redistribute and/or modify under the terms of the GNU Lesser General
15 Public License Version 3 as published by the Free Software Foundation or
16 (at your option) any later version approved by the Aurora Free Open Source
17 Software Organization. The license is available in the package root path
18 as 'LICENSE' file. Please review the following information to ensure the
19 GNU Lesser General Public License version 3 requirements will be met:
20 https://www.gnu.org/licenses/lgpl.html .
21 
22 Alternatively, this file may be used under the terms of the GNU General
23 Public License version 3 or later as published by the Free Software
24 Foundation. Please review the following information to ensure the GNU
25 General Public License requirements will be met:
26 https://www.gnu.org/licenses/gpl-3.0.html.
27 
28 NOTE: All products, services or anything associated to trademarks and
29 service marks used or referenced on this file are the property of their
30 respective companies/owners or its subsidiaries. Other names and brands
31 may be claimed as the property of others.
32 
33 For more info about intellectual property visit: aurorafoss.org or
34 directly send an email to: contact (at) aurorafoss.org .
35 */
36 
37 module aurorafw.entity.system;
38 
39 import aurorafw.entity.systemmanager;
40 
41 version (unittest) import aurorafw.unit.assertion;
42 
43 abstract class System
44 {
45 	/**
46 	 * Update Policy
47 	 *
48 	 * Changes the way world handles system updates
49 	 *     Automatic: it's called everytime on the word loop update
50 	 *     Manual: the user decides when he wants the system to be updated
51 	 */
52 	enum UpdatePolicy
53 	{
54 		Automatic,
55 		Manual
56 	}
57 
58 	@safe pure
59 	public this(UpdatePolicy updatePolicy = UpdatePolicy.Automatic)
60 	{
61 		this.updatePolicy = updatePolicy;
62 	}
63 
64 	/**
65 	 * Manager
66 	 *
67 	 * Returns the Entity Manager
68 	 *
69 	 * Examples:
70 	 * --------------------
71 	 * auto entityManager = this.manager;
72 	 * --------------------
73 	 */
74 	@safe pure
75 	public SystemManager manager()
76 	{
77 		return _manager;
78 	}
79 
80 	/**
81 	 * Manager
82 	 *
83 	 * Sets the Entity Manager for the current system
84 	 * This function is used internaly only
85 	 *
86 	 * Examples:
87 	 * --------------------
88 	 * System foo = new System();
89 	 * foo.manager = anEntityManager;
90 	 * --------------------
91 	 */
92 	@safe pure
93 	package SystemManager manager(SystemManager manager)
94 	{
95 		return _manager = manager;
96 	}
97 
98 	/**
99 	 * Update
100 	 *
101 	 * Use this method to update each system
102 	 *
103 	 * Examples:
104 	 * --------------------
105 	 * final class FooSystem : System
106 	 * {
107 	 *    override public void update() { *everything you want to update* }
108 	 * }
109 	 * --------------------
110 	 */
111 	public abstract void update();
112 
113 	public UpdatePolicy updatePolicy;
114 	private SystemManager _manager;
115 }