private ProtoEntity[,] ConvertToDrawableGrid(BatchedGrid grid, Rectangle visibleCoordinates) { throw new NotImplementedException(); /* * * ProtoEntity[,] drawGrid = new ProtoEntity[visibleCoordinates.Width, visibleCoordinates.Height]; * * //Point startCoordinate = visibleCoordinates.Location; * //Point endCoordinate = startCoordinate + visibleCoordinates.Size; * * for (int i = 0; i < grid.Batches.Length; i++) * { * CellBatch batch = grid.Batches[i]; * * //if (batch.Bounds.Intersects(visibleCoordinates)) * //{ * // if (batch is BitMapBatch) * // { * // ParseBitMapBatch((BitMapBatch)batch, ref drawGrid, visibleCoordinates); * * * // } * //} * } * * return drawGrid; * */ }
private void BuildStates() { menu = new GameState("Menu"); stateManager.RequestStatePush(menu); Clickable button = new Clickable(uiTextures.GetAsset("Button"), new Vector2(200), MouseButtons.LMB); menu.CreateNewEntity(button); button.OnClickEvent += ActivateLevel; button = new Clickable(uiTextures.GetAsset("Button"), new Vector2(400), MouseButtons.LMB); menu.CreateNewEntity(button); button.OnClickEvent += ActivateLevel; level = new GameState("Level", StateActivityLevel.Inactive); stateManager.RequestStatePush(level); DrawLayer terrainLayer = level.CreateNewDrawLayer("IsoTerrain", false, new Vector2(64, 32)); //DrawLayer cartTerrainLayer = menu.CreateNewDrawLayer("CartTerrain", false, new Vector2(32), new Vector2(400, 0)); DrawLayer structureLayer = level.CreateNewDrawLayer("Structures", false, new Vector2(64, 32)); BatchedGrid <ProtoEntity> isoTerrain = BatchedGrid <ProtoEntity> .CreateIsometricGrid(new Vector2(0, 0), false, textures.GetAsset("GridTile"), textures.GetAsset("GrassTile")); level.CreateNewEntity("IsoTerrain", isoTerrain); //Terrain cartTerrain = Terrain.CreateSquareTerrain(new Vector2(4, 0), new Vector2(10), textures.GetAsset("GridTile"), textures.GetAsset("GrassTopDown")); //menu.CreateNewEntity("CartTerrain", cartTerrain); var rand = new Random(); for (var i = 0; i < 500; i++) { var pos = new Vector2(rand.Next(100), rand.Next(100)); var gridObject = GridObject.CreateIsometricGridObject(textures.GetAsset("Obelisk"), structureLayer, pos, new Vector2(2)); level.CreateNewEntity("Structures", gridObject); pos = new Vector2(rand.Next(100), rand.Next(100)); gridObject = GridObject.CreateIsometricGridObject(textures.GetAsset("House"), structureLayer, pos, new Vector2(1)); level.CreateNewEntity("Structures", gridObject); } var cameraController = new CameraController(menu.Camera); level.CreateNewEntity(cameraController); options = new GameState("Options", StateActivityLevel.Inactive); stateManager.RequestStatePush(options); Clickable exitButton = new Clickable(uiTextures.GetAsset("Button"), new Vector2(0)); exitButton.OnClickEvent += Quit; options.CreateNewEntity(exitButton); }