public LevelTree(int number, int x_size, int y_size, int direction, GameObject tile, GameObject wall, int x, int y) { this.x_size = x_size; this.y_size = y_size; this.number = number; this.direction = direction; this.tile = tile; this.wall = wall; makeWall(this.x_size, this.y_size, x, y); makeMap(this.x_size, this.y_size, x, y); if (number > 0) { if (direction != ConstDirectionNum.right) //Left Direction { LevelTree leftTree = new LevelTree(UnityEngine.Random.Range(0, number - 1), x_size, y_size, ConstDirectionNum.left, tile, wall, x - x_size, y); } if (direction != ConstDirectionNum.left) //Right Direction { LevelTree leftTree = new LevelTree(UnityEngine.Random.Range(0, number - 1), x_size, y_size, ConstDirectionNum.right, tile, wall, x + x_size, y); } if (direction != ConstDirectionNum.up) // Down Direction { LevelTree leftTree = new LevelTree(UnityEngine.Random.Range(0, number - 1), x_size, y_size, ConstDirectionNum.down, tile, wall, x, y - y_size); } if (direction != ConstDirectionNum.down) //Up Direction { LevelTree leftTree = new LevelTree(UnityEngine.Random.Range(0, number - 1), x_size, y_size, ConstDirectionNum.up, tile, wall, x, y + y_size); } } }
// Start is called before the first frame update void Start() { LevelTree lvTree = new LevelTree(map_sizeField, x_sizeField, y_sizeField, ConstDirectionNum.root, tile, wall, 0, 0); }