public void GenerateWorld(GenerationProgress progress = null) { Stopwatch stopwatch = new Stopwatch(); float num = 0.0f; foreach (GenPass pass in this._passes) { num += pass.Weight; } if (progress == null) { progress = new GenerationProgress(); } WorldGenerator.CurrentGenerationProgress = progress; progress.TotalWeight = num; foreach (GenPass pass in this._passes) { WorldGen._genRand = new UnifiedRandom(this._seed); Main.rand = new UnifiedRandom(this._seed); stopwatch.Start(); progress.Start(pass.Weight); pass.Apply(progress, this._configuration.GetPassConfiguration(pass.Name)); progress.End(); stopwatch.Reset(); } WorldGenerator.CurrentGenerationProgress = (GenerationProgress)null; }
public void GenerateWorld(GenerationProgress progress = null) { Stopwatch stopwatch = new Stopwatch(); float num = 0f; foreach (GenPass pass in _passes) { num += pass.Weight; } if (progress == null) { progress = new GenerationProgress(); } progress.TotalWeight = num; Main.menuMode = 888; Main.MenuUI.SetState(new UIWorldLoad(progress)); foreach (GenPass pass2 in _passes) { WorldGen._genRand = new UnifiedRandom(_seed); Main.rand = new UnifiedRandom(_seed); stopwatch.Start(); progress.Start(pass2.Weight); pass2.Apply(progress, _configuration.GetPassConfiguration(pass2.Name)); progress.End(); stopwatch.Reset(); } }
public void Apply(GenerationProgress progress, GameConfiguration configuration) { if (_onBegin != null) { _onBegin(this); } ApplyPass(progress, configuration); if (_onComplete != null) { _onComplete(this); } }
protected override void ApplyPass(GenerationProgress progress, GameConfiguration configuration) { int num = _count; while (num > 0) { if (_perUnit(GenBase._random.Next(1, GenBase._worldWidth), GenBase._random.Next(1, GenBase._worldHeight))) { num--; } } }
public void Apply(GenerationProgress progress, GameConfiguration configuration) { if (this._onBegin != null) { this._onBegin(this); } this.ApplyPass(progress, configuration); if (this._onComplete == null) { return; } this._onComplete(this); }
protected override void ApplyPass( GenerationProgress progress, GameConfiguration configuration) { int count = this._count; while (count > 0) { if (this._perUnit(GenBase._random.Next(1, GenBase._worldWidth), GenBase._random.Next(1, GenBase._worldHeight), new object[0])) { --count; } } }
protected override void ApplyPass(GenerationProgress progress, GameConfiguration configuration) { for (int i = 0; i < GenBase._worldWidth; i++) { for (int j = 0; j < GenBase._worldHeight; j++) { if (GenBase._tiles[i, j] == null) { GenBase._tiles[i, j] = new Tile(); } else { GenBase._tiles[i, j].ClearEverything(); } } } }
protected override void ApplyPass( GenerationProgress progress, GameConfiguration configuration) { for (int index1 = 0; index1 < GenBase._worldWidth; ++index1) { for (int index2 = 0; index2 < GenBase._worldHeight; ++index2) { if (GenBase._tiles[index1, index2] == null) { GenBase._tiles[index1, index2] = new Tile(); } else { GenBase._tiles[index1, index2].ClearEverything(); } } } }
protected abstract void ApplyPass(GenerationProgress progress, GameConfiguration configuration);