コード例 #1
0
 public void loadHomeMenu()
 {
     print("Home = " + homeMenuScene);
     print("Next = " + nextScene);
     Application.LoadLevel(homeMenuScene);
     GameWon.Set_WinConditions();
 }
コード例 #2
0
 public void CheckGameWon()
 {
     if (_current == _finish)
     {
         GameWon?.Invoke(_count);
     }
 }
コード例 #3
0
        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);
            }
        }
コード例 #4
0
ファイル: Game.cs プロジェクト: asyncful/BombFinder
 private void CheckForVictory()
 {
     if (IsGameRunning && NumRevealedCells == cells.Count - model.NumBombs)
     {
         IsGameRunning = false;
         GameWon.Invoke();
     }
 }
コード例 #5
0
 /// <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++;
 }
コード例 #6
0
    void VictorySequence()
    {
        GameWon.Invoke();
        musicPlayer.clip = victoryMusic;
        musicPlayer.Play();

        // Show the victory text
        victoryText.enabled = true;

        Application.Quit();
        //FadeIntoTitleScreen();
    }
コード例 #7
0
 // 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);
         }
     }
 }
コード例 #8
0
    private void OnZombiDied(Zombi zombi)
    {
        zombi.Died -= OnZombiDied;

        _waveSize--;

        if (_waveSize == 0 && _currentWaveIndex >= _waves.Count)
        {
            GameWon?.Invoke();
        }
        else if (_waveSize == 0)
        {
            WaveEnded?.Invoke();
        }
    }
コード例 #9
0
    internal void IncreaseScore()
    {
        _score++;
        ScoreChanged?.Invoke(_score);

        if (_score == _scoreForVictory - 1)
        {
            GameWining?.Invoke();
        }

        if (_score == _scoreForVictory)
        {
            GameWon?.Invoke();
            StartCoroutine(DelayedColliderReactivation());
        }
    }
コード例 #10
0
 /// <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());
         }
     }
 }
コード例 #11
0
    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 ();
    }
コード例 #12
0
ファイル: Logic.cs プロジェクト: Ethan-S-Dev/SudokoProject
        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);
        }
コード例 #13
0
    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);
        }
    }
コード例 #14
0
 private void DeclareWinner(TicTacToePlayerTurn whoWon)
 {
     Winner = whoWon == TicTacToePlayerTurn.X ? TicTacToeWinner.X : TicTacToeWinner.O;
     GameWon?.Invoke(this, new TicTacToeWinEventArgs(Winner));
 }
コード例 #15
0
 public void loadHomeMenu()
 {
     Application.LoadLevel(homeMenuScene);
     GameWon.Set_WinConditions();
 }
コード例 #16
0
    private void WinGame()
    {
        IsGameRunning = false;

        GameWon.SafeInvoke();
    }
コード例 #17
0
 //Restart current scene
 public void restartbutton()
 {
     Application.LoadLevel(Application.loadedLevel);
     GameWon.Set_WinConditions();
 }
コード例 #18
0
 //Load next scene
 public void loadNextScene()
 {
     Application.LoadLevel(nextScene);
     GameWon.Set_WinConditions();
 }
コード例 #19
0
 public static void WinGame() => GameWon?.Invoke();
コード例 #20
0
ファイル: Scene.cs プロジェクト: xwind13/BricksGame
        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();
                }
            }
        }
コード例 #21
0
 private void DeclareStalemate()
 {
     Winner = TicTacToeWinner.Stalemate;
     GameWon?.Invoke(this, new TicTacToeWinEventArgs(TicTacToeWinner.Stalemate));
 }
コード例 #22
0
 private void OnGameWon(EventData eventData)
 {
     GameWon?.Invoke(eventData);
 }
コード例 #23
0
    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);
        }
    }
コード例 #24
0
ファイル: Game.cs プロジェクト: connlaoi-education/durak
 protected virtual void OnGameWon()
 {
     GameWon?.Invoke(this, EventArgs.Empty);
 }
コード例 #25
0
 public void GameOver(object sender, GameWon p)
 {
     MessageBox.Show(p.Winner.ToString() + " WINS!");
     label1.Text = "X: " + xWins + " | O: " + oWins;
 }
コード例 #26
0
ファイル: SceneHolder.cs プロジェクト: Vipinsoni38/Sleepy_boo
 void ShowWonScreen()
 {
     GameWon.SetActive(true);
 }
コード例 #27
0
ファイル: Runtime.cs プロジェクト: Pelsen85/OOP
 public void OnGameWin(object sender, EventArgs e)
 {
     GameWon?.Invoke(sender, e);
 }