public UHISimulation(ISimulationMap map) { mapSize = map.GetMapSize(); sunlight = new Sunlight(); sunlight.SetSunPosition(13); coordsMap = new Coord[mapSize, mapSize]; coordsList = new List <Coord>(); this.map = map; }
private void MapTranslate(ISimulationMap map, List <ISimulationTile> tilesWithObjects) { for (int row = 0; row < mapSize; row++) { for (int col = 0; col < mapSize; col++) { Coord coord = new Coord(row, col); coordsMap[row, col] = coord; coordsList.Add(coord); coord.CoordType = map.GetTile(row, col).GetTileType(); } } if (tilesWithObjects != null && tilesWithObjects.Count() != 0) { foreach (ISimulationTile tile in tilesWithObjects) { int row = tile.GetRow(); int col = tile.GetColumn(); int rowSize = tile.GetGameObject().GetRowSize(); int colSize = tile.GetGameObject().GetColSize(); int halfRowSize = (rowSize - 1) / 2; int halfColSize = (colSize - 1) / 2; if (halfRowSize > 0 && halfColSize > 0) { for (int i = -halfRowSize; i < halfRowSize; i++) { for (int j = -halfColSize; j < halfColSize; j++) { if ((row + i) < mapSize && (row + i) >= 0 && (col + j) < mapSize && (col + j) >= 0) { coordsMap[row + i, col + j].Height = tile.GetGameObject().GetHeight(); coordsMap[row + i, col + j].CoordType = TypeMapping(tile.GetGameObject().GetObjectType()); } } } } else if (halfRowSize > 0 && halfColSize == 0) { for (int i = -halfRowSize; i < halfRowSize; i++) { coordsMap[row + i, col].Height = tile.GetGameObject().GetHeight(); coordsMap[row + i, col].CoordType = TypeMapping(tile.GetGameObject().GetObjectType()); } } else if (halfRowSize == 0 && halfColSize > 0) { for (int j = -halfColSize; j < halfColSize; j++) { coordsMap[row, col + j].Height = tile.GetGameObject().GetHeight(); coordsMap[row, col + j].CoordType = TypeMapping(tile.GetGameObject().GetObjectType()); } } else if (halfRowSize == 0 && halfColSize == 0) { coordsMap[row, col].Height = tile.GetGameObject().GetHeight(); coordsMap[row, col].CoordType = TypeMapping(tile.GetGameObject().GetObjectType()); } } } ShadeMapping(); }