public void RandomFillMap() { _map = new RawGrid[_mapWidth * _mapHeight]; _grid = new Grid[_mapWidth * _mapHeight]; int middle = 0; int index; for (int x = 0; x < _mapWidth; x++) { for (int y = 0; y < _mapHeight; y++) { index = x + y * _mapHeight; _map[index] = new RawGrid(); _grid[index] = new Grid(new Vector3(x, y, 0f), Tile.Full); //Border if (x == 0 || y == 0 || (x == _mapWidth - 1) || (y == _mapHeight - 1)) { _map[index].BasicValue = 1; } // Inside else { /*middle = (_mapHeight / 2); * * if (y == middle) * _map[x + y * _mapHeight].BasicValue = 0; * else*/ _map[index].BasicValue = GetRandomTileStatus(_percentage); } } } }
public void RandomFillMap() { setSizes(); _map = new RawGrid[_mapWidth * _mapHeight]; _grid = new Grid[_mapWidth * _mapHeight]; int index; for (int x = 0; x < _mapWidth; x++) { for (int y = 0; y < _mapHeight; y++) { index = x + y * _mapHeight; _map[index] = new RawGrid(); _grid[index] = new Grid(calcWorldCoord(new Vector2(x, y)), Tile.Full); _grid[index].posX = x; _grid[index].posY = y; //Border if (x == 0 || y == 0 || (x == _mapWidth - 1) || (y == _mapHeight - 1)) _map[index].BasicValue = BasicValues.Wall; // Inside else _map[index].BasicValue = GetRandomTileStatus(_percentage); } } }
public static Grid[] BasicValueToStatus(RawGrid[] rawGrid, int width, int height) { int length = rawGrid.Length; Grid[] changedGrid = new Grid[length]; for (int x = 0; x < width; x++) { for (int y = 0; y < height; y++) { changedGrid[x + y * height] = new Grid(new Vector3(x, y, 0f)); changedGrid[x + y * height].BasicValue = rawGrid[x + y * height].BasicValue; if (rawGrid[x + y * height].BasicValue == 0) { changedGrid[x + y * height].status = Status.Revealed; changedGrid[x + y * height].tile = Tile.Floor; } else { changedGrid[x + y * height].status = Status.Undisclosed; changedGrid[x + y * height].tile = Tile.Full; } } } return changedGrid; }
public void RandomFillMap() { _map = new RawGrid[_mapWidth * _mapHeight]; _grid = new Grid[_mapWidth * _mapHeight]; int middle = 0; int index; for (int x = 0; x < _mapWidth; x++) { for (int y = 0; y < _mapHeight; y++) { index = x + y * _mapHeight; _map[index] = new RawGrid(); _grid[index] = new Grid(new Vector3(x, y, 0f), Tile.Full); //Border if (x == 0 || y == 0 || (x == _mapWidth - 1) || (y == _mapHeight - 1)) { _map[index].BasicValue = 1; } // Inside else { /*middle = (_mapHeight / 2); if (y == middle) _map[x + y * _mapHeight].BasicValue = 0; else*/ _map[index].BasicValue = GetRandomTileStatus(_percentage); } } } }