private void CreateHome() { GeneratorTemplate template = new TemplateHome(Random.Next()); template.Build(this); Map map = template.Map; SetMapId("home", map); Tile startTile = template.GetStartRoom(); Tile stairDown = template.BuildStairRoom(); StairDown stairTile = new StairDown() { Type = StairType.RandomStart, }; stairTile.InitBonuses(); stairDown.Replace(stairTile); }
public override void Build(SceneGame world) { World = world; Random = new Random(Seed); Map = world.CreateMap(100, 100); Map.Bonuses = Bonuses; world.SetMapId(Guid.NewGuid(), Map); foreach (var bonus in Bonuses) { bonus.Bonus.Apply(GroupGenerator); } MapGenerator generator = new MapGenerator(Map.Width, Map.Height, Seed, GroupGenerator, Bonuses); generator.SetupDefaultOres(); generator.Generate(); generator.Print(Map); Rooms = generator.GetRooms(Map).ToList(); int followups = 1; if (Random.NextDouble() < 0.4) { followups = Random.Next(2, 4); } for (int i = 0; i < followups; i++) { var nextStair = BuildStairRoom(); var group = nextStair.Group; StairDown stairTile = new StairDown() { Type = StairType.Random, Seed = Random.Next(), }; stairTile.InitBonuses(); nextStair.Replace(stairTile); } }