예제 #1
0
        private void CreateTestWorld()
        {
            var world = new WorldInst(RpConfig.Default.DefaultSpawnWorld);

            world.Create();
            world.Clock.SetTime(new WorldTime(0, 8), 15.0f);
            world.Clock.Stop();
            WorldInst.List.Add(world);
        }
예제 #2
0
        public static GameMode InitScenario(GameScenario scenario)
        {
            if (scenario == null)
            {
                return(null);
            }

            if (IsActive)
            {
                NextScenarioIndex = GameScenario.Scenarios.IndexOf(scenario);
                ActiveMode.FadeOut();
                return(null);
            }

            Log.Logger.Log("Init game scenario " + scenario.Name);

            if (++NextScenarioIndex >= GameScenario.Count)
            {
                NextScenarioIndex = 0;
            }

            var mode = scenario.GetMode();

            ActiveMode = mode;

            var world = new WorldInst(null)
            {
                Path = scenario.WorldPath
            };

            world.Create();

            SetWorldGlobals(world, scenario);
            mode.World = world;

            if (!string.IsNullOrWhiteSpace(scenario.SpawnWorld))
            {
                var spawnWorld = new WorldInst(null)
                {
                    Path = scenario.SpawnWorld
                };
                spawnWorld.Create();

                SetWorldGlobals(spawnWorld, scenario);
                mode.SpawnWorld = spawnWorld;
            }

            mode.Start(scenario);

            return(mode);
        }