public World(int width, int height) { spaceStation = new Entity.SpaceStation(301); dynamicCellSpacePartition = new Systems.CellSpacePartition(spaceStation.Diameter, spaceStation.Diameter, 4); }
private void SetPlanetClass(PlanetClass p_class) { planetClass = p_class; planetMap = new PlanetMap(); entities = new List <Entity.BaseGameEntity>(); entityParticle = new Systems.ParticleSystem(500); bulletManager = new Systems.BulletManager(500); switch (p_class) { case PlanetClass.ClassA: { cellSpacePartition = new Systems.CellSpacePartition((int)(double)lua["ClassA.Width"], (int)(double)lua["ClassA.Height"], 4); tilePartition = new Systems.CellSpacePartition((int)(double)lua["ClassA.Width"], (int)(double)lua["ClassA.Height"], 4); mapGenerator = new MapGenerator( (int)(double)lua["ClassA.Width"], (int)(double)lua["ClassA.Height"], (int)(double)lua["ClassA.MaxRooms"], (int)(double)lua["ClassA.RoomMaxSize"], (int)(double)lua["ClassA.RoomMinSize"]); planetMap = mapGenerator.CreateMap(); break; } case PlanetClass.ClassB: { cellSpacePartition = new Systems.CellSpacePartition((int)(double)lua["ClassB.Width"], (int)(double)lua["ClassB.Height"], 4); tilePartition = new Systems.CellSpacePartition((int)(double)lua["ClassB.Width"], (int)(double)lua["ClassB.Height"], 4); mapGenerator = new MapGenerator( (int)(double)lua["ClassB.Width"], (int)(double)lua["ClassB.Height"], (int)(double)lua["ClassB.MaxRooms"], (int)(double)lua["ClassB.RoomMaxSize"], (int)(double)lua["ClassB.RoomMinSize"]); planetMap = mapGenerator.CreateMap(); break; } case PlanetClass.ClassC: { cellSpacePartition = new Systems.CellSpacePartition((int)(double)lua["ClassC.Width"], (int)(double)lua["ClassC.Height"], 4); tilePartition = new Systems.CellSpacePartition((int)(double)lua["ClassC.Width"], (int)(double)lua["ClassC.Height"], 4); mapGenerator = new MapGenerator( (int)(double)lua["ClassC.Width"], (int)(double)lua["ClassC.Height"], (int)(double)lua["ClassC.MaxRooms"], (int)(double)lua["ClassC.RoomMaxSize"], (int)(double)lua["ClassC.RoomMinSize"]); planetMap = mapGenerator.CreateMap(); break; } case PlanetClass.ClassD: { cellSpacePartition = new Systems.CellSpacePartition((int)(double)lua["ClassD.Width"], (int)(double)lua["ClassD.Height"], 4); tilePartition = new Systems.CellSpacePartition((int)(double)lua["ClassD.Width"], (int)(double)lua["ClassD.Height"], 4); mapGenerator = new MapGenerator( (int)(double)lua["ClassD.Width"], (int)(double)lua["ClassD.Height"], (int)(double)lua["ClassD.MaxRooms"], (int)(double)lua["ClassD.RoomMaxSize"], (int)(double)lua["ClassD.RoomMinSize"]); planetMap = mapGenerator.CreateMap(); break; } } for (int y = 0; y < planetMap.tilemap.GetLength(1); y++) { for (int x = 0; x < planetMap.tilemap.GetLength(0); x++) { tilePartition.AddEntity(new Entity.Tile(new Vector2(x * 128, y * 128), planetMap.tilemap[x, y])); } } lua.DoFile("Scripts/Planets/Generation.lua"); }