示例#1
0
 public static void StartNextScenario()
 {
     if (IsActive)
     {
         ActiveMode.FadeOut();
     }
     else
     {
         InitScenario(GameScenario.Get(NextScenarioIndex));
     }
 }
示例#2
0
        public static void Start(string name)
        {
            var scenario = GameScenario.Get(name);

            if (scenario == null)
            {
                throw new Exception("GameScenario not found: " + name);
            }

            if (ActiveMode != null)
            {
                ActiveMode.End();
            }
            ActiveMode = scenario.GetMode();
            ActiveMode.Start(scenario);
        }
示例#3
0
        protected virtual void End()
        {
            Log.Logger.Log("End");

            phaseTimer.Stop();

            // Reset game mode stats of players
            ArenaClient.ForEach(c =>
            {
                c.GMClass  = null;
                c.GMKills  = 0;
                c.GMScore  = 0;
                c.GMDeaths = 0;
            });

            var oldWorld      = this.World;
            var oldSpawnWorld = this.SpawnWorld;

            this.World      = null;
            this.SpawnWorld = null;

            var oldPlayers = new List <ArenaClient>(players);

            this.players.Clear();

            // initialize next scenario, creates a new world
            ActiveMode = null;
            var newMode = InitScenario(GameScenario.Get(NextScenarioIndex));

            // move players to next scenario
            oldPlayers.ForEach(p => newMode.JoinAsSpectator(p));

            ClearAgents();
            // delete old world
            oldWorld.Delete();

            if (oldSpawnWorld != null)
            {
                oldSpawnWorld.Delete();
            }
        }