示例#1
0
        /// <summary>
        /// Begins the game, letting it start its update loop
        /// </summary>
        /// <param name="shouldDoWorldSetup">Whether to create tanks and map objects</param>
        public void BeginGame(bool shouldDoWorldSetup = true)
        {
            if (HasStarted)
            {
                return;
            }
            if (!HasEnoughPlayersToStart)
            {
                return;
            }

            EventEngine.UnsafeDisableEvents();

            HasStarted = true;

            Status = CurrentGameStatus.GameRunning;

            if (shouldDoWorldSetup)
            {
                //Create the player objects (server only)
                SetupGamePlayers();
                //And load the map / create the map objects
                CreateMapObjects();
            }
            Gamemode.StartGame();

            EventEngine.UnsafeEnableEvents();
            //And raise events
            EventEngine.RaiseGameStarted();
        }