public static void GameOver() { gameOver = true; Time.timeScale = 0; VictoryDialog victoryDialog = Resources.Load <VictoryDialog>("Prefabs/UI/VictoryDialog"); Instantiate(victoryDialog); if (OnGameOver != null) { OnGameOver(); } }
private void OnButtonClick(Button button, int posX, int posY) { if (button.Enabled) { button.Text = playerSymbol; battleMatrix[posX, posY] = button; button.Enabled = false; } // Human Victory if (GameLogic.CheckVictory(battleMatrix, playerSymbol)) { Label_Victories_Value.Text = (int.Parse(Label_Victories_Value.Text) + 1).ToString(); OnGameTerminated(true); VictoryDialog.Create(); OnGameReset(); return; } GameLogic.EnemyMovement(IAsymbol, battleMatrix); // CPU Victory if (GameLogic.CheckVictory(battleMatrix, IAsymbol)) { Label_Defeats_Value.Text = (int.Parse(Label_Defeats_Value.Text) + 1).ToString(); OnGameTerminated(false); DefeatDialog.Create(); OnGameReset(); return; } }