public Room(Bounds bounds, HashSet <Vector3> occupiedPoints) { this.bounds = bounds; int l = (int)bounds.size.x; int w = (int)bounds.size.y; int h = (int)bounds.size.z; var v0 = BoundedSpace.roundVector(bounds.min, 0); cells = new Dictionary <Vector3, Cell>(); for (int i = 0; i < l; i++) { for (int j = 0; j < w; j++) { for (int k = 0; k < h; k++) { var v1 = new Vector3(i, j, k) + v0; if (!occupiedPoints.Contains(v1)) { cells[v1] = new Cell(v1); } occupiedPoints.Add(v1); } } } createBorderGeometry(); }
public override bool Equals(object obj) { BoundedSpace other = obj as BoundedSpace; if (other == null) { return(false); } return(this.bounds == other.bounds); }
public Room(Rect rect, int height, int z) { bounds = new Bounds(new Vector3(rect.xMin, rect.yMin, z), Vector3.zero); bounds.Encapsulate(new Vector3(rect.max.x, rect.max.y, z + height)); cells = new Dictionary <Vector3, Cell>(); int l = (int)rect.width; int w = (int)rect.height; int h = (int)height; var v0 = BoundedSpace.roundVector(new Vector3(rect.xMin, rect.yMin, z), 0); for (int i = 0; i < l; i++) { for (int j = 0; j < w; j++) { for (int k = 0; k < h; k++) { var v1 = new Vector3(i, j, k) + v0; cells[v1] = new Cell(v1); } } } createBorderGeometry(); }
public void addNeighbor(Vector3 v, BoundedSpace space) { neighbors[v] = space; }
public void addNeighbor(BoundedSpace space) { var v = space.bounds.center - bounds.center; addNeighbor(v, space); }