private void Intialise() { MenuScreen = GameObjectUtilities.GetChildComponent <UIMenuController> (this.transform); GameScreen = GameObjectUtilities.GetChildComponent <UIGameController> (this.transform); PauseScreen = GameObjectUtilities.GetChildComponent <UIPauseController> (this.transform); GameOverScreen = GameObjectUtilities.GetChildComponent <UIGameOverController> (this.transform); EventManager.OnStateChanged += OnStateSwitched; }
private void Awake() { //Singleton if (instance == null) { instance = this; } else if (instance != this) { Destroy(gameObject); } }
public void HandleGameOver(bool weWon, bool isFromDisconnect = false) { // Don't process this more than once if (this._isGameOver) { return; } this._isGameOver = true; DebugLog.LogWarningColor("Game over | isFromDisconnect: " + isFromDisconnect.ToString(), LogColor.blue); float delaySeconds = isFromDisconnect ? 1.0f : 2.0f; CoroutineHelper.Instance.RunAfterDelay(delaySeconds, () => { if (this != null && this.View != null) { UIGameOverController gameOverController = new UIGameOverController(weWon, () => { this.LeaveGame(); }); gameOverController.PresentDialog(); } }); }