void Update() { PointerRay.Update(); GameMode currentGameMode = GameFlowManager.Instance.GetCurrentGameMode(); if (currentGameMode != _oldGameMode) { if (CurrentModeManager != null) { CurrentModeManager.OnGameModeQuit(); } CurrentModeManager = null; foreach (VRGameModeManager manager in _gameModeManagers) { if (manager.GameMode == currentGameMode) { manager.OnGameModeStarted(); CurrentModeManager = manager; break; } } if (CurrentModeManager == null) { throw new NotImplementedException("Manager for GameMode: " + currentGameMode + " could not be found"); } } CurrentModeManager.OnGameModeUpdate(); _oldGameMode = currentGameMode; }
public void AddGameModeManager(VRGameModeManager gameModeManager) { for (int i = 0; i < _gameModeManagers.Count; i++) { if (_gameModeManagers[i].GameMode == gameModeManager.GameMode) { throw new InvalidOperationException("There is already a manager for the GameMode \"" + gameModeManager.GameMode.ToString() + "\""); } } _gameModeManagers.Add(gameModeManager); }