コード例 #1
0
        /// <summary>
        /// Clears up the match - removes goalposts and puck, ad decides the winning team.
        /// </summary>
        public void EndGame()
        {
            bool redWon = false;

            if (m_redScore >= 3)
            {
                redWon = true;
            }

            //By default, blue has won, unless red has.

            string winner = (redWon) ? "Reds" : "Blues";

            foreach (GamePlayer pl in PlayingPlayers)
            {
                if (pl == null)
                {
                    continue;
                }
                if (pl.ObjectState != GameObject.eObjectState.Active)
                {
                    continue;
                }

                //Inform the players of the winner!
                pl.Out.SendMessage("The game is over! Congratulations to the winning team, the " + winner + "!", DOL.GS.PacketHandler.eChatType.CT_Broadcast, DOL.GS.PacketHandler.eChatLoc.CL_ChatWindow);

                //Remove the stick from the player.
                RemoveStick(pl);
            }

            if (Puck != null)
            {
                Puck.RemoveFromWorld();
                Puck.Delete();
            }

            playState = ePlayState.Waiting;

            //Flush player lists...
            m_redTeam        = new List <GamePlayer>();
            m_blueTeam       = new List <GamePlayer>();
            m_playingPlayers = new List <GamePlayer>();
        }