Exemplo n.º 1
0
 public Scene(int seed, XMLModel.WorldSettings settings, XMLModel.DecorationCollection decorationCollection, BiomeCollection biomeCollection)
 {
     Seed               = seed;
     Settings           = settings;
     DecorationSettings = decorationCollection;
     BiomeCollection    = biomeCollection;
 }
Exemplo n.º 2
0
        public void GenerateWorld(int seed, XMLModel.DecorationCollection decorationSettings, XMLModel.WorldSettings worldSettings, World.BiomeCollection biomeCollection, XMLModel.Civilization[] civSettings, int civs, int radius, int ticks)
        {
            var stopwatch = new Stopwatch();

            stopwatch.Start();
            // Generate world
            Debug.WriteLine("Generating world for seed " + seed);
            Scene = new Scene(seed, worldSettings, decorationSettings, biomeCollection);
            var random     = new Random(seed);
            var randomCivs = civSettings.OrderBy(x => random.Next()).ToArray();
            var generator  = new WorldGenerator(Scene, randomCivs);

            generator.GenerateWorld(radius);
            generator.GenerateCivs(civs);

            Simulator = new Simulator(Scene, ticks);

            stopwatch.Stop();
            Debug.WriteLine("Generated world in " + stopwatch.ElapsedMilliseconds + " ms");
            // Let the scene renderer generate the new meshes
            SceneRenderer.OnNewWorldGenerated(Scene, seed);

            UI.GameUI = new GameUI(this);
        }