Exemplo n.º 1
0
        public void Load(ComputationLevel reqlevel, int[] tiles)
        {
            planet.Log("Load({0}, {1} tiles)", reqlevel, tiles.Length);
            var watch = System.Diagnostics.Stopwatch.StartNew();
            ComputationLevel minlevel;

            while ((minlevel = tiles.Select(x => planet.data[x].Level).Min()) < reqlevel)
            {
                int[] tiles2 = tiles.Where(x => planet.data[x].Level == minlevel).ToArray();

                switch (minlevel)
                {
                case ComputationLevel.NOTHING:
                    SampleTerrain(tiles2);
                    break;

                case ComputationLevel.TERRAIN_SAMPLED:
                    PlaceCities(tiles2);
                    break;

                case ComputationLevel.CITIES_PLACED:
                    foreach (var i in tiles2)
                    {
                        planet.data[i].FindCityBorder();
                    }
                    break;

                default:
                    planet.Log("Level {0}: {1} ms", Level, watch.ElapsedMilliseconds);
                    return;
                }
            }

            planet.Log("Level {0}: {1} ms", Level, watch.ElapsedMilliseconds);
        }
Exemplo n.º 2
0
        public TileData(Planet planet, int index)
        {
            this.planet = planet;
            this.index  = index;

            Level = ComputationLevel.NOTHING;

            PRNG      = new System.Random(planet.TileSeeds[index]);
            CityScore = PRNG.NextDouble();
        }
Exemplo n.º 3
0
 public void Load(ComputationLevel reqlevel)
 {
     Load(reqlevel, new int[] { index });
 }
Exemplo n.º 4
0
 public void Load(ComputationLevel reqlevel)
 {
     Load(reqlevel, new int[] { index });
 }
Exemplo n.º 5
0
        public void Load(ComputationLevel reqlevel, int[] tiles)
        {
            planet.Log("Load({0}, {1} tiles)", reqlevel, tiles.Length);
            var watch = System.Diagnostics.Stopwatch.StartNew();
            ComputationLevel minlevel;

            while ((minlevel = tiles.Select(x => planet.data[x].Level).Min()) < reqlevel)
            {
                int[] tiles2 = tiles.Where(x => planet.data[x].Level == minlevel).ToArray();

                switch (minlevel)
                {
                case ComputationLevel.NOTHING:
                    SampleTerrain(tiles2);
                    break;

                case ComputationLevel.TERRAIN_SAMPLED:
                    PlaceCities(tiles2);
                    break;

                case ComputationLevel.CITIES_PLACED:
                    foreach(var i in tiles2)
                        planet.data[i].FindCityBorder();
                    break;

                default:
                    planet.Log("Level {0}: {1} ms", Level, watch.ElapsedMilliseconds);
                    return;
                }
            }

            planet.Log("Level {0}: {1} ms", Level, watch.ElapsedMilliseconds);
        }