private static void InitializeGame() { // Reset everything GC.Collect(); mechanics.Buildings = new List <Building>(); interactives = new List <Interactive>(); tileMap = new Tile[1, 1]; mechanics = new Mechanics(); citizens = new List <Citizen>(); // Regenerate everything tileMap = new MapGenerator().GetMap(250, 250); roads = new Road[250, 250]; InteractiveGenerator.PlaceInteractives(tileMap); // Sort trees so they are rendered correctly IOrderedEnumerable <Interactive> sortedInteractives = interactives.OrderBy(interactive => interactive.Coords.Y); interactives = new List <Interactive>(); foreach (Interactive inter in sortedInteractives) { interactives.Add(inter); } buttons = new List <Button>(); uiElements = new List <UIElement>(); MenuBuilder.BuildGameMenu(); }
protected override void Initialize() { base.Initialize(); IsMouseVisible = true; cam.Pos = new Vector2(10000, 10000); cam.Zoom = 0.5f; interactives = new List <Interactive>(); buttons = new List <Button>(); mainButtons = new List <Button>(); uiElements = new List <UIElement>(); roads = new Road[1, 1]; tileMap = new Tile[1, 1]; mechanics = new Mechanics(); MenuBuilder.BuildMainMenu(); tileSize = (int)mapTileSheet.Sprite(TexturePackerMonoGameDefinitions.texturePackerSpriteAtlas.Grass1).Size.X; }