// private static readonly Vector2Int[] AdjacentDelta = new[] // { // Vector2Int.right, // Vector2Int.up, // Vector2Int.left, // Vector2Int.down, // }; public WFCGenerator(Vector3Int size, Vector3Int[] neighborOffset, IEnumerable <Pattern <T> > patterns) { Size = size; Patterns = new HashSet <Pattern <T> >(patterns); ChunkStates = new ChunkState <Pattern <T> > [size.x, size.y, size.z]; NeighborOffset = neighborOffset; _random = new Random(); }
public void Reset(int seed) { _propagationStack.Clear(); _random = new Random(seed); for (var x = 0; x < Size.x; x++) { for (var y = 0; y < Size.y; y++) { for (var z = 0; z < Size.z; z++) { ChunkStates[x, y, z] = new ChunkState <Pattern <T> >(Patterns, NeighborOffset.Length); } } } }
public void Resize(Vector3Int size) { Size = size; ChunkStates = new ChunkState <Pattern <T> > [size.x, size.y, size.z]; }