1 #pragma warning disable 0649 8 namespace HKI.Core.GameSystems
23 [SerializeField] [Scene]
string FailedInitScene =
"";
28 [SerializeField]
GameEvent InitFinishedGameEvent = null;
58 int gameSystemsForUpdateLenght = 0;
59 int gameSystemsForFixedUpdateLenght = 0;
60 int gameSystemsForLateUpdateLenght = 0;
69 SceneManager.SetActiveScene(gameObject.scene);
73 if(GameSystemsForUpdate != null)
74 gameSystemsForUpdateLenght = GameSystemsForUpdate.Length;
76 if(GameSystemsForFixedUpdate != null)
77 gameSystemsForFixedUpdateLenght = GameSystemsForFixedUpdate.Length;
79 if(GameSystemsForLateUpdate != null)
80 gameSystemsForLateUpdateLenght = GameSystemsForLateUpdate.Length;
84 if(GameSystemsForInit != null)
86 int gameSystemsForInitLenght = GameSystemsForInit.Length;
87 for(
int i = 0; i < gameSystemsForInitLenght; i++)
89 SceneLoader.
ChangeText(GameSystemsForInit[i].GetInitInfoTextLocalization);
91 yield
return StartCoroutine(GameSystemsForInit[i].Init());
93 if (!GameSystemsForInit[i].InitSuccessful)
95 SceneLoader.
ChangeText(GameSystemsForInit[i].GetInitErrorInfoTextLocalization);
97 Debug.LogError(
"(GameSystemUpdateManager) failed to initialize (GameSystem)" + GameSystemsForInit[i].name);
99 if(!
string.IsNullOrEmpty(FailedInitScene))
101 if(SceneLoader != null)
104 SceneManager.LoadScene(FailedInitScene);
112 if (InitFinishedGameEvent != null)
113 InitFinishedGameEvent.
Raise();
121 if(GameSystemsForShutdown != null)
123 int gameSystemsForShutdownLenght = GameSystemsForShutdown.Length;
124 for (
int i = 0; i < gameSystemsForShutdownLenght; i++)
125 GameSystemsForShutdown[i].Shutdown();
139 if(GameSystemsForUpdate != null)
141 for(
int i = 0; i < gameSystemsForUpdateLenght; i++)
142 GameSystemsForUpdate[i].Update();
153 if(GameSystemsForFixedUpdate != null)
155 for (
int i = 0; i < gameSystemsForFixedUpdateLenght; i++)
156 GameSystemsForFixedUpdate[i].FixedUpdate();
165 if(GameSystemsForLateUpdate != null)
167 for (
int i = 0; i < gameSystemsForLateUpdateLenght; i++)
168 GameSystemsForLateUpdate[i].LateUpdate();
This MonoBehaviour controlls all GameSystems. It's responsble to initialize, update and shutdown this...
IEnumerator Start()
The Start function initialized all GameSystems. For a smoother framerate it's using coroutines...
GameSystem [] GameSystemsForShutdown
The Shutdown function of this GameSystems will be called on destroy of this MonoBehaviour.
void Raise()
Calling this function will inform all registered listener that this event is raised.
GameSystem [] GameSystemsForUpdate
This GameSystems will be updated on Update.
void OnDestroy()
OnDestroy is responsible for shutting all GameSystems down.
void Update()
The Update function updates the TimeSystem and then updates all GameSystems.
GameSystem [] GameSystemsForLateUpdate
This GameSystems will be updated on LateUpdate.
void ChangeText(TextLocalization textLocalization)
This ScriptableObject spawns the SceneLoaderController prefab and gives access to the SceneLoaderCont...
This system stores all engine time values so that can be used by other systems without having to call...
void LoadSceneDirect(string scene)
GameSystem [] GameSystemsForInit
This GameSystems will be initialized.
GameSystem [] GameSystemsForFixedUpdate
This GameSystems will be updated on FixedUpdate.
void LateUpdate()
Like the Update function, the LateUpdate function updates the TimeSystem and then updates all GameSys...
This is a ScriptableObject game event. It can be listen too and raised via code or within Unity Edito...
void FixedUpdate()
Like the Update function, the FixedUpdate function updates the TimeSystem and then updates all GameSy...
This MonoBehaviour controls scene changing and the blending of the fading overlay for scene transitio...
This ScriptableObject is the abstract base class for all GameSystems. It provides "interface" functio...