public void loadHomeMenu() { print("Home = " + homeMenuScene); print("Next = " + nextScene); Application.LoadLevel(homeMenuScene); GameWon.Set_WinConditions(); }
public void CheckGameWon() { if (_current == _finish) { GameWon?.Invoke(_count); } }
public void Reveal(TileProperty tile) { if (tile.IsFlagged || tile.IsRevealed || GameOver) { return; } tile.IsRevealed = true; if (tile.IsBomb) { OnGameLose(); return; } RevealedSuccess++; if (tile.SurroundingCount == 0) { RevealAllSurrounding(tile); } if (RevealedSuccess == RevealToWin) { GameOver = true; GameWon.Invoke(this, EventArgs.Empty); } }
private void CheckForVictory() { if (IsGameRunning && NumRevealedCells == cells.Count - model.NumBombs) { IsGameRunning = false; GameWon.Invoke(); } }
/// <summary> /// Turns on all the collectibles in the beginning, finds the total number of collectibles /// </summary> void Start() { active = true; gameObject.SetActive(active); ducks = GameObject.FindGameObjectsWithTag("Duck"); gameWonScript = GameObject.FindGameObjectWithTag("WinManager").GetComponent <GameWon>(); // set the total collectibles of gameWon to be the total number of collectibles in the scene gameWonScript.totalCollectibles++; }
void VictorySequence() { GameWon.Invoke(); musicPlayer.clip = victoryMusic; musicPlayer.Play(); // Show the victory text victoryText.enabled = true; Application.Quit(); //FadeIntoTitleScreen(); }
// Update is called once per frame void Update() { GameWon.Set_WinConditions(); if (GameWon.IsWon() == true) { // Set active congratulations to ative. Unity does not support activating so had to update foreach (GameObject obj2 in gratsPanel) { obj2.SetActive(true); } } }
private void OnZombiDied(Zombi zombi) { zombi.Died -= OnZombiDied; _waveSize--; if (_waveSize == 0 && _currentWaveIndex >= _waves.Count) { GameWon?.Invoke(); } else if (_waveSize == 0) { WaveEnded?.Invoke(); } }
internal void IncreaseScore() { _score++; ScoreChanged?.Invoke(_score); if (_score == _scoreForVictory - 1) { GameWining?.Invoke(); } if (_score == _scoreForVictory) { GameWon?.Invoke(); StartCoroutine(DelayedColliderReactivation()); } }
/// <summary> /// Controls if the player wins or if the quota text will flash red /// </summary> private void OnGoalEntered() { if (quota <= 0) { GameWon?.Invoke(); quotaText.text = "You Win! Press here to go to the main menu!"; button.enabled = true; quotaImage.enabled = true; } else { if (!isAlreadyFlashing) { StartCoroutine(FlashRedCoroutine()); } } }
protected void OnWin() { if (_gameOver) { return; } GameController.Instance.TimeElapsing = true; _gameOver = true; Debug.Log("Gagné"); Close(); if (OnWinEvent != null) { OnWinEvent(); } GameWon?.Invoke(); //FindObjectOfType<GameMusicInit> ().PlayGameMusic (); }
public bool EnterNumber(int pos, byte num) { if (Valid(pos, num)) { currentBoard[pos] = num; bool finished = true; for (int i = 0; i < 81; i++) { if (currentBoard[i] == 0) { finished = false; break; } } if (finished) { GameWon?.Invoke(this, new GameWonEventArgs(currentBoard, dif)); } return(true); } return(false); }
public bool Move(int row, int col, string movedPiece) { if (PlayablePieces.Contains(movedPiece) && GameBoard[row, col] == "[]") { Debug.Log("Setting move in model - " + movedPiece); GameBoard[row, col] = movedPiece; PlayablePieces.Remove(movedPiece); GameOver = HasWon(row, col); CheckTieGame(); if (GameOver) { Debug.Log(Environment.NewLine + "GAME OVER" + Environment.NewLine); GameWon?.Invoke(); } return(true); } else { return(false); } }
private void DeclareWinner(TicTacToePlayerTurn whoWon) { Winner = whoWon == TicTacToePlayerTurn.X ? TicTacToeWinner.X : TicTacToeWinner.O; GameWon?.Invoke(this, new TicTacToeWinEventArgs(Winner)); }
public void loadHomeMenu() { Application.LoadLevel(homeMenuScene); GameWon.Set_WinConditions(); }
private void WinGame() { IsGameRunning = false; GameWon.SafeInvoke(); }
//Restart current scene public void restartbutton() { Application.LoadLevel(Application.loadedLevel); GameWon.Set_WinConditions(); }
//Load next scene public void loadNextScene() { Application.LoadLevel(nextScene); GameWon.Set_WinConditions(); }
public static void WinGame() => GameWon?.Invoke();
private void HandleMovingSquareStateChangedEvent(ISquare sq) { var ms = sq as MovingSquare; if (ms.IsMoving == true) { return; } var dir = new MoveDirection(ms.Direction); var dest = ms.Destination; var lastIndex = _matrixField.GetLastIndexInDirection(ms.Direction); if (dest == lastIndex) { var side = ms.Direction switch { Direction.Down => Side.Bottom, Direction.Up => Side.Top, Direction.Left => Side.Left, Direction.Right => Side.Right, _ => throw new InvalidEnumArgumentException($"{ms.Direction} is invalid argument") }; var lineIdx = dir.IsHorzOrient() ? ms.Y : ms.X; _sideFields[side].Push(lineIdx, ms.Color); } else { (uint x, uint y) = dir.IsHorzOrient() ? (dest, ms.Y) : (ms.X, dest); _matrixField.SetSquareState(x, y, ms.Color, ms.Direction); var combinations = _matrixField.GetSquareCombinations(); foreach (var combination in combinations) { _score.Add(combination.Count()); CombinationDestroyed?.Invoke(combination); foreach (var item in combination) { _matrixField.ResetSquareState(item.X, item.Y); } } } var(square, destination) = _matrixField.FindSquareWithDestinationToMove(); if (destination != -1) { _movingSquare.Start((square.X, square.Y), square.Color, square.State.Direction.Value, (uint)destination); _matrixField.ResetSquareState(square.X, square.Y); } if (!_movingSquare.IsMoving) { if (!_matrixField.HasActiveSquares()) { _score.AddWinScore(); _matrixField.Reset(); GameWon?.Invoke(); //ClearStateHistory(); } else if (_matrixField.IsMoveDeadlock()) { GameOver?.Invoke(); } } }
private void DeclareStalemate() { Winner = TicTacToeWinner.Stalemate; GameWon?.Invoke(this, new TicTacToeWinEventArgs(TicTacToeWinner.Stalemate)); }
private void OnGameWon(EventData eventData) { GameWon?.Invoke(eventData); }
private IEnumerator EndGame(int enemySelection) { Selections selection = (Selections)enemySelection; bool gameWon = false; yield return(new WaitForSeconds(2)); if (PlayerSelection == selection) { DrawTextUI.SetActive(true); WinTextUI.SetActive(false); LoseTextUI.SetActive(false); } else if (PlayerSelection == Selections.Rock && selection == Selections.Scissors) { gameWon = true; DrawTextUI.SetActive(false); WinTextUI.SetActive(true); LoseTextUI.SetActive(false); } else if (PlayerSelection == Selections.Paper && selection == Selections.Rock) { gameWon = true; DrawTextUI.SetActive(false); WinTextUI.SetActive(true); LoseTextUI.SetActive(false); } else if (PlayerSelection == Selections.Scissors && selection == Selections.Paper) { gameWon = true; DrawTextUI.SetActive(false); WinTextUI.SetActive(true); LoseTextUI.SetActive(false); } else if (selection == Selections.Rock && PlayerSelection == Selections.Scissors) { DrawTextUI.SetActive(false); WinTextUI.SetActive(false); LoseTextUI.SetActive(true); } else if (selection == Selections.Paper && PlayerSelection == Selections.Rock) { DrawTextUI.SetActive(false); WinTextUI.SetActive(false); LoseTextUI.SetActive(true); } else if (selection == Selections.Scissors && PlayerSelection == Selections.Paper) { DrawTextUI.SetActive(false); WinTextUI.SetActive(false); LoseTextUI.SetActive(true); } if (gameWon && gameMode == Gamemodes.Multi) { GameWon?.Invoke(); } if (gameMode == Gamemodes.Multi) { RetryButton.SetActive(false); } else { RetryButton.SetActive(true); } if (DrawTextUI.activeInHierarchy) { EndGamePanel.SetActive(false); EnableDisableButtons(true); if (gameMode == Gamemodes.Single) { SceneManager.LoadScene(1); } } else { EndGamePanel.SetActive(true); } }
protected virtual void OnGameWon() { GameWon?.Invoke(this, EventArgs.Empty); }
public void GameOver(object sender, GameWon p) { MessageBox.Show(p.Winner.ToString() + " WINS!"); label1.Text = "X: " + xWins + " | O: " + oWins; }
void ShowWonScreen() { GameWon.SetActive(true); }
public void OnGameWin(object sender, EventArgs e) { GameWon?.Invoke(sender, e); }