private void AddArrow(Tile[,] tileGrid, Point point, ArrowType layerType, int indexOffset) { if (CreatingWorld.IsStraightRoad(tileGrid, point)) { tileGrid[point.X, point.Y].AddLayer(GroundLayerController.GetLayerByIndex(LayerType.ROADDECALS, (int)layerType + indexOffset)); } }
private void AddLayerCorner(int nX, int nY, LayerType layerType, int bitMaskValue, Tile[,] tileGrid) { Tile tile = tileGrid[nX, nY]; if (bitMaskValue == 1) //NorthWest { if (!tile.IsBitMaskIdInList(layerType, 128) && !tile.IsBitMaskIdInList(layerType, 2)) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); } } if (bitMaskValue == 4) //NorhtEast { if (!tile.IsBitMaskIdInList(layerType, 2) && !tile.IsBitMaskIdInList(layerType, 8)) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); } } if (bitMaskValue == 16) //SouthEast { if (!tile.IsBitMaskIdInList(layerType, 8) && !tile.IsBitMaskIdInList(layerType, 32)) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); } } if (bitMaskValue == 64) //SouthWest { if (!tile.IsBitMaskIdInList(layerType, 32) && !tile.IsBitMaskIdInList(layerType, 64)) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); } } }
public BorderMap(CompressedBuilding compressedBuilding, EditorParams editorParams) { this.editorParams = editorParams; this.compressedBuilding = compressedBuilding; normalBorderMap = new Border[editorParams.overallSize, editorParams.overallSize]; roadList = new List <GroundLayer>(); highlight = new Border(11, 0, 0, 5); highlight.visible = false; for (int x = 0; x < editorParams.overallSize; x++) { for (int y = 0; y < editorParams.overallSize; y++) { normalBorderMap[x, y] = new Border(20, x, y, 2); } } for (int x = 0; x < editorParams.overallSize; x++) { if (compressedBuilding.baseDirectionFacing == 0) { roadList.Add(GroundLayerController.GetLayerByIndex(LayerType.CITYROAD, 2)); //North } else { roadList.Add(GroundLayerController.GetLayerByIndex(LayerType.CITYROAD, 1)); //West } } }
public void SetBurntLayer() { if (fire != null) { burntLayer = GroundLayerController.GetBurntLayerByBitMask(fire.GetBurntLayerBitMaskId()); } }
private void Debugging(Dictionary <int, AStarNode> checkedNodeList, Dictionary <int, AStarNode> toCheckList) { foreach (AStarNode node in toCheckList.Values) //Yellow to check { Point point = node.GetCurrent2D(); WorldController.world.tileGrid[point.X, point.Y].AddLayer(GroundLayerController.GetLayerByIndex(LayerType.BORDER, 4)); } foreach (AStarNode node in checkedNodeList.Values) { Point point = node.GetCurrent2D(); WorldController.world.tileGrid[point.X, point.Y].AddLayer(GroundLayerController.GetLayerByIndex(LayerType.BORDER, 8)); } }
public AddingRoadTiles(Tile[,] tileGrid, LoadingInfo loadingInfo) { float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; List <Point> pointsToUpdateList = new List <Point>(); for (int x = 0; x < CreatingWorld.worldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.AddingRoadTiles, percentDone); for (int y = 0; y < CreatingWorld.worldHeight; y++) { if (CheckRoad(x, y, 0, tileGrid)) { int bitCount = BitMaskValue(x, y, tileGrid); if (bitCount > -1) { Tile tile = tileGrid[x, y]; int index = BitMask.GetTileIndexFromBitmask(bitCount); if (index > -1 && index < 56) { if (tile.GetLandType() == LandType.CITYROAD) { tile.AddLayer(GroundLayerController.GetLayerByIndex(LayerType.CITYROAD, index)); tile.SetTileLogistic(TileLogisticsController.GetTileLogistic(LandType.CITYROAD, index)); } else if (tile.GetLandType() == LandType.COUNTRYROAD) { tile.AddLayer(GroundLayerController.GetLayerByIndex(LayerType.COUNTRYROAD, index)); tile.SetTileLogistic(TileLogisticsController.GetTileLogistic(LandType.COUNTRYROAD, index)); } } /*else if (index == 56) * { * pointsToUpdateList.Add(new Point(x, y)); * }*/ } } } } }
public LandMass(Tile[,] tileGrid, double[,] waterMap, LoadingInfo loadingInfo) { //following number is amount of ground layers groundLevels = new double[50]; float value = -5.5f; for (int i = 0; i < groundLevels.Length; i++) { groundLevels[i] = value; value += 0.20f; } float percentDone = 0; float percentJump = 100f / CreatingWorld.worldWidth; for (int x = 0; x < CreatingWorld.worldWidth; x++) { percentDone += percentJump; loadingInfo.UpdateLoading(LoadingType.BuildingLandMass, percentDone); for (int y = 0; y < CreatingWorld.worldHeight; y++) { if (tileGrid[x, y] == null) { int layerIndex = GetLayerIndex(waterMap[x, y]); LayerType layerType = (LayerType)layerIndex; if (layerIndex > waterCoastline) { Tile tile = new Tile(GroundLayerController.GetRandomLayer(layerType), TileLogisticsController.GetTileLogistic(LandType.OPEN, 0), x, y); tileGrid[x, y] = tile; } else { Tile tile = new Tile(GroundLayerController.GetRandomLayer(layerType), TileLogisticsController.GetTileLogistic(LandType.WATER, 0), x, y); tileGrid[x, y] = tile; } if (x == 0 || x == CreatingWorld.worldWidth - 1 || y == 0 || y == CreatingWorld.worldHeight - 1) { Tile tile = new Tile(GroundLayerController.GetLayerByIndex(LayerType.BORDER, 0), TileLogisticsController.GetTileLogistic(LandType.BORDER, 0), x, y); tileGrid[x, y] = tile; } } } } }
protected override void Initialize() { debugDrawTimeStopwatch = new Stopwatch(); // Window.IsBorderless = false; Data.SetSettings(); ScreenController.graphicsDevice = GraphicsDevice; DisplayController.Init(this); EngineController.Init(); GraphicsManager.Init(Content); AudioManager.Init(Content); //Game specific init. this could probably be done in game load GroundLayerController.Init(); AngleStuff.Init(); PieceController.Init(); ShadowSpriteController.Init(); MapObjectController.Init(); TileLogisticsController.Init(); GraphicsDevice.Clear(Color.White); IsMouseVisible = true; base.Initialize(); ScreenController.ChangeScreen(new MenuMain()); }
private void AddLayer(int nX, int nY, LayerType layerType, int bitMaskValue, Tile[,] tileGrid) { tileGrid[nX, nY].AddLayer(GroundLayerController.GetLayerByBitMask(layerType, bitMaskValue)); }
public void AddDebug(List <DrivingNode> myList) { foreach (DrivingNode drivingNode in myList) { WorldController.world.tileGrid[drivingNode.GetLocationX(), drivingNode.GetLocationY()].AddLayer(GroundLayerController.GetLayerByIndex(LayerType.BORDER, 12)); } }
private void AddWhiteLine(Tile[,] tileGrid, int tileX, int tileY, int tileIndex) { tileGrid[tileX, tileY].AddLayer(GroundLayerController.GetLayerByIndex(LayerType.ROADDECALS, tileIndex)); }