/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. This /// is where it can query for any required services and load any non-graphic related /// content. Calling base.Initialize will enumerate through any components and initialize /// them as well. /// </summary> protected override void Initialize() { base.Initialize(); // get the JSON that the engine will be initialized with string snapshotJson = File.ReadAllText("../../../../../Assets/snapshot.json"); string templateJson = File.ReadAllText("../../../../../Assets/templates.json"); _gameEngine = new GameEngineManager(snapshotJson, templateJson, targetUpdatesPerSecond: 15); }
void Awake() { //Check if there is already an instance of SoundManager if (instance == null) { //if not, set it to this. instance = this; for (int i = 0; i < maxPlayers; i++) { playerGameStats.Add(new PlayerGameStats { health = 100f, score = 0f, controllerID = i + 1 }); } } //If instance already exists: else if (instance != this) //Destroy this, this enforces our singleton pattern so there can only be one instance of SoundManager. Destroy(gameObject); DontDestroyOnLoad(gameObject); }