Created
January 31, 2019 07:39
-
-
Save Zammy/7f0b1775e4dc8d89d7b858376e5b6755 to your computer and use it in GitHub Desktop.
Base bootstrapper tightly coupled with ServiceLocator
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using System.Collections.Generic; | |
using MEC; | |
public class Bootstrapper : MonoBehaviour | |
{ | |
protected virtual void Awake() | |
{ | |
} | |
protected virtual void Start() | |
{ | |
ServiceLocator.Instance.InitServices(); | |
Timing.RunCoroutine(LateInit()); | |
} | |
IEnumerator<float> LateInit() | |
{ | |
yield return Timing.WaitForOneFrame; | |
ServiceLocator.Instance.LateInitServices(); | |
} | |
void OnDestroy() | |
{ | |
ServiceLocator.Instance.DestroyServices(); | |
} | |
void OnApplicationPause(bool pauseStatus) | |
{ | |
ServiceLocator.Instance.OnAppPauseServices(pauseStatus); | |
} | |
void Update() | |
{ | |
ServiceLocator.Instance.TickServices(Time.deltaTime, Time.unscaledDeltaTime); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment