Example #1
0
        /// <summary>
        /// Ends the current game.
        /// </summary>
        /// <param name="player">The player that has won/lost.</param>
        /// <param name="type">The result of the game (win/loss).</param>
        public virtual void EndGame(PlayerInfo player, EndGameType type)
        {
            gameFinished = true;
            var msg = new EndGameMessage();

            switch (type)
            {
            case EndGameType.Win:
                msg.winnerPlayerIndex = player.netId;
                break;

            case EndGameType.Loss:
                msg.winnerPlayerIndex = gameState.players.Find(x => x != player).netId;
                break;
            }
            NetworkServer.SendToAll(NetworkProtocol.EndGame, msg);
        }
Example #2
0
 public virtual void OnEndGame(EndGameMessage msg)
 {
 }