Exemple #1
0
        private void OnGameOver(object sender, GameOverEventArgs e)
        {
            string messageText = null;

            switch (e.GameState)
            {
            case GameState.InProgress:
                break;

            case GameState.Player1Won:
                messageText = "Player 1 won.";
                break;

            case GameState.Player2Won:
                messageText = "Player 2 won.";
                break;

            case GameState.Draw:
                messageText = "Draw.";
                break;

            default:
                break;
            }
            MessageBox.Show(messageText, "Game over");
            InitializeBoardManager(false);
            this.Invalidate(true);
        }
Exemple #2
0
 private void Game_GameOver(object sender, GameOverEventArgs e)
 {
     foreach (Tile tile in e.WinningTiles)
     {
         HighlightedTiles.Add(this[tile.X, tile.Y]);
     }
 }
Exemple #3
0
 private void ClearAllCurrency(GameOverEventArgs args)
 {
     currencyPool.ForEach((currency) =>
     {
         currency.gameObject.SetActive(false);
     });
 }
 private void OnGameOver(object sender, GameOverEventArgs e)
 {
     map.Pause();
     mode.Stop();
     scoreField.text = "Score: " + e.gameScore;
     userInterface.SetActive(true);
     scorePanel.SetActive(true);
 }
Exemple #5
0
    private void GameOver()
    {
        GameIsOver = true;

        var args = new GameOverEventArgs(availableRevives);

        OnGameOver?.Invoke(args);
    }
 private void OnGameOver(GameOverEventArgs args)
 {
     if (args.CanRevive)
     {
         reviveDisplay.SetActive(true);
         StartCoroutine(CountdownUpdate());
     }
 }
Exemple #7
0
 private void GameOver(object sender, GameOverEventArgs e)
 {
     _model._timerOn = false;
     isWinner        = true;
     _panel.Refresh();
     MessageBox.Show(e.type, "Game over");
     NewGame();
 }
    private void OnGameOver(GameOverEventArgs args)
    {
        if (args.CanRevive)
        {
            return;
        }

        display.SetActive(true);
        roundText.text = $"You have reached\nRound {levelManager.RoundIndex + 1} of {levelManager.RoundCount}";
    }
 // When the game ends I want to be able to reload the active scene to restart. However, you might
 // notice that the GameEvents I make are static. Static things don't get destroyed on reload, and
 // Unity seems to throw a huge fit when an event tries to call a function that doesn't exist (because
 // the thing it was tied to is destroyed.) Thus, every function connected to GameEvents must have the
 // connection severed before the game is reloaded. The connections will be remade by the new versions
 // of these classes on boot.
 void OnGameOver(object sender, GameOverEventArgs args)
 {
     GameEvents.TaskUIStarted        -= OpenUI;
     GameEvents.TaskCompleted        -= OnTaskCompleted;
     GameEvents.AddColonist          -= OnAddColonist;
     GameEvents.RemoveRandomColonist -= OnRemoveRandomColonist;
     GameEvents.RemoveColonist       -= OnRemoveColonist;
     GameEvents.RoboAttack           -= OnRoboAttack;
     GameEvents.GameOver             -= OnGameOver;
 }
    protected virtual void OnGameOver(string score)
    {
        GlobalVariables.score = score;
        Application.LoadLevel("game_over");

        if (gameOverEvent != null) {
            GameOverEventArgs a = new GameOverEventArgs();
            a.score = score;
            gameOverEvent(this, a);
        }
    }
Exemple #11
0
 private void ViewModel_GameOver(object sender, GameOverEventArgs e)
 {
     if (e.result)
     {
         MessageBox.Show("Gratulálok, győztél!", "Győzelem", MessageBoxButton.OK);
     }
     else
     {
         MessageBox.Show("Sajnos vesztettél :(", "Kudarc", MessageBoxButton.OK);
     }
 }
Exemple #12
0
        private void GameOver(object sender, GameOverEventArgs e)
        {
            // display info who is a winner

            if (e.WinnerColor == null)
            {
                playerInfo.UpdateInfoField("played a draw!");
            }
            else
            {
                playerInfo.UpdateInfoField(e.WinnerColor + " won!");
            }
        }
Exemple #13
0
 private void HandleOnGameOver(object sender, GameOverEventArgs gameOverEventArgs)
 {
     bool onCompleteAdded = false;
     foreach (Image ren in GameOverScreen.GetComponentsInChildren<Image>(true))
     {
         Color c = ren.color;
         float targetAlpha = c.a;
         c.a = 0.0f;
         ren.color = c;
         Tweener tween = ren.DOFade(targetAlpha, 4.0f);
         if (!onCompleteAdded)
         {
             onCompleteAdded = true;
             tween.OnComplete(() => SceneLoader.Instance.LoadLevel(SceneManager.GetActiveScene().name));
         }
     }
     GameOverScreen.gameObject.SetActive(true);
 }
Exemple #14
0
 protected void OnGameOver(GameOverEventArgs e)
 {
     if (GameOver != null)
     {
         GameOver(this, e);
     }
 }
 private void GameEventManagerOnGameOver(object sender, GameOverEventArgs gameOverEventArgs)
 {
     Log.InfoFormat("[GameEventManagerOnGameOver] {0}{2} => {1}.", gameOverEventArgs.Result,
         GameEventManager.Instance.LastGamePresenceStatus, gameOverEventArgs.Conceded ? " [conceded]" : "");
 }
 void RaiseGameOverEvent(GameOverEventArgs e)
 {
     if (GameOverEvent != null)
     {
         GameOverEvent(this, e);
     }
 }
Exemple #17
0
        /// <summary>
        ///     Begins a new round of Blackjack.
        /// </summary>
        public void Deal()
        {
            if (_gameInProgress)
            {
                return; // do not continue if a game is already in progress.
            }

            _gameOverArgs = null;
            _gameInProgress = true;

            resetGame();

            dealCardToHand(_playerHand);
            dealCardToHand(_dealerHand);

            dealCardToHand(_playerHand);
            if (_gameInProgress)
                // check if this is still true, as game may have moved into Stand() with player's 2nd card.
            {
                dealCardToHand(_dealerHand, Visibility.Closed);
            }

            OnPlayersTurn(EventArgs.Empty);
        }
        private void OnGameOver(object sender, GameOverEventArgs gameOverEventArgs)
        {
            //notify player wins
            gameOverEventArgs
                .WinnerPlayer
                .GetSignalRConnections()
                .ForEach(c => _hubContext.Clients.Client(c.ToString()).endGame(true));

            //notify player lose
            Game.GetPlayerById(gameOverEventArgs.WinnerPlayer.Id, theOtherOne: true)
                .GetSignalRConnections()
                .ForEach(c => _hubContext.Clients.Client(c.ToString()).endGame(false));
        }
Exemple #19
0
        private void evaluateScores()
        {
            if (_playerBust)
            {
                _dealerScore++;
                _gameOverArgs = new GameOverEventArgs(Result.PlayerLoses);
            }
            else if (_dealerBust && !_playerBust)
            {
                _playerScore++;
                _gameOverArgs = new GameOverEventArgs(Result.PlayerWins);
            }
            else if (playerEvalTotal > dealerEvalTotal)
            {
                _playerScore++;
                _gameOverArgs = new GameOverEventArgs(Result.PlayerWins);
            }
            else if (playerEvalTotal < dealerEvalTotal)
            {
                _dealerScore++;
                _gameOverArgs = new GameOverEventArgs(Result.PlayerLoses);
            }
            else
            {
                ++_drawCount;
                _gameOverArgs = new GameOverEventArgs(Result.Draw);
            }

            _gameInProgress = false;
            OnGameOver(_gameOverArgs);
        }