-
Notifications
You must be signed in to change notification settings - Fork 1
SceneController
Feynmen edited this page Jun 18, 2018
·
7 revisions
On each scene, you must create the class which inherited from SceneControllerBase and it to GameObject on the scene. This class is the start point of the workflow on the scene. The second step is to add scene name to this script on the scene. (This option will be removed in future)
This class do finding on the scene all GameObjects with class ControllerBase, add it to the dictionary, inject managers and init ControllerBase.
- Unity Awake
- Finding class which inherited from CoreSystem and add reference. (In Editor mode you mustn't add ApplicationSystem into the current scene. ApplicationSystem will be Instantiate to the scene from the path in variable DEBUG_APPSYS_PREFAB_PATH )
- Adding SceneController reference into founded Controllers using Injection
- Unity IEnumerator Start
- Adding Managers reference into founded Controllers which using Injection attribute
- Init founded Controllers
- Execute PreInitExecutionQueue
- Invoke Init function of SceneController
- From yours Controllers you can add IEnumerator method to PreInitExecutionQueue
public Queue<IEnumerator> PreInitExecutionQueue- You can get access to other controllers using these functions:
public T Get<T>() where T : ControllerBase
public ControllerBase Get(Type controllerType)
public bool TryGet<T>(out T controller) where T : ControllerBase- You can set Enable state to Controllers
public void Enable<T>() where T : ControllerBase
public void Disable<T>() where T : ControllerBasepublic class TestSceneController : SceneControllerBase
{
public override IEnumerator Init()
{
yield return null;
}
}