private void OnEndGame(PSide side, ChessGame.EndGames endType)
    {
        // Display message accordingly to end type
        switch (endType)
        {
        case ChessGame.EndGames.Checkmate:
            _popupText.text = (side == PSide.Black ? "Black" : "White") + " is mated!";
            GetPieceGameObject(ChessGame.getKing(_currentGame.Gameboard, side)).GetComponent <Animator>().SetTrigger("Mated");
            break;

        case ChessGame.EndGames.Draw:
            _popupText.text = "Players agreed to a draw!";
            break;

        case ChessGame.EndGames.Stalemate:
            _popupText.text = "It's a stalemate!";
            break;

        default:
            _popupText.text = "This shouldn't happen. WTF man...";
            break;
        }

        _popupText.gameObject.SetActive(true);
        _popupBehavior.StartPhaseOut();
    }
 private void OnCheck(PSide side, ChessGame.EndGames endType)
 {
     // Display pop-up message "Check !"
     _popupText.text = (side == PSide.Black ? "Black" : "White") + " is checked!";
     _popupText.gameObject.SetActive(true);
     _popupBehavior.StartPhaseOut();
 }
Beispiel #3
0
        public void OnEndGame(PSide side, ChessGame.EndGames endType)
        {
            PlaySound(Sounds.endgame);
            switch (endType)
            {
            case (ChessGame.EndGames.Checkmate): { MessageBox.Show(null, side.ToString() + " has been checkmated!", "Game over", MessageBoxButtons.OK, MessageBoxIcon.Information); break; }

            case (ChessGame.EndGames.Draw): { MessageBox.Show(null, "Game drawn, 50/50", "Game over", MessageBoxButtons.OK, MessageBoxIcon.Information); break; }

            case (ChessGame.EndGames.Stalemate): { MessageBox.Show(null, "StaleMate, 50/50", "Game over", MessageBoxButtons.OK, MessageBoxIcon.Information); break; }
            }

            btn_reset.Enabled = true;
        }