Created
December 11, 2018 02:25
-
-
Save codehoose/804478ea3fe60cb8b220fce871ce51dd to your computer and use it in GitHub Desktop.
The `GameSystems` MonoBehaviour is the singleton and contains code to access the systems in the game from one location.
This file contains hidden or 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
public class GameSystems : MonoBehaviour | |
{ | |
private static GameSystems _instance; | |
public static GameSystems Instance | |
{ | |
get | |
{ | |
if (_instance == null) | |
{ | |
_instance = GameObject.FindObjectOfType<GameSystems>(); | |
if (_instance == null) | |
{ | |
var go = new GameObject("__GAMESYSTEMS__"); | |
_instance = go.AddComponent<GameSystems>(); | |
_instance.Cloud = CloudFactory.Create(); | |
_instance.FileIO = FileSystemFactory.Create(); | |
} | |
} | |
} | |
} | |
public ICloudService Cloud { get; private set; } | |
public IFileSystem FileIO { get; private set; } | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment