private RoomDecoration CreateWall(Vector2Int startPoint, RoomDecoration roomDecoration, Vector2Int axis, int length, bool door) { int doorSize = Random.Range(1, Mathf.RoundToInt(length / 1.8f) + 1); int doorStartIndex = Random.Range(1, length - doorSize); for (int i = 0; i < length; i++) { Vector2Int newIndex = startPoint + (axis * i); if (door && i >= doorStartIndex && i < doorStartIndex + doorSize) { roomDecoration.decorationCode[newIndex.x, newIndex.y] = "D"; } else { roomDecoration.decorationCode[newIndex.x, newIndex.y] = "1"; } } if (door) { DoorLayout doorLayout = new DoorLayout(doorSize, doorStartIndex, axis); roomDecoration.doorList.Add(doorLayout); } return(roomDecoration); }
public RoomDecoration(int width, int height, Vector2Int index) { this.width = width; this.height = height; this.index = index; this.decorationCode = new string[width, height]; for (int y = height - 1; y >= 0; y--) { for (int x = 0; x < width; x++) { decorationCode[x, y] = "0"; } } doorList = new List <DoorLayout>(); NoDoorData = new DoorLayout(0, 0, Vector2Int.zero); }