public T this[Coord c] { get { return(array[(c.z - rect.offset.z) * rect.size.x + c.x - rect.offset.x]); } set { array[(c.z - rect.offset.z) * rect.size.x + c.x - rect.offset.x] = value; } }
public bool CheckInRange(Coord coord) { return(coord.x >= offset.x && coord.x < offset.x + size.x && coord.z >= offset.z && coord.z < offset.z + size.z); }
public bool CheckInRangeAndBounds(Coord coord) { return(coord.x > offset.x && coord.x < offset.x + size.x - 1 && coord.z > offset.z && coord.z < offset.z + size.z - 1); }
public CoordRect(Rect r) { offset = new Coord((int)r.x, (int)r.y); size = new Coord((int)r.width, (int)r.height); }
public CoordRect(float offsetX, float offsetZ, float sizeX, float sizeZ) { this.offset = new Coord((int)offsetX, (int)offsetZ); this.size = new Coord((int)sizeX, (int)sizeZ); }
public CoordRect(int offsetX, int offsetZ, int sizeX, int sizeZ) { this.offset = new Coord(offsetX, offsetZ); this.size = new Coord(sizeX, sizeZ); }
//public int radius; //not related with size, because a clamped CoordRect should have non-changed radius public CoordRect(Coord offset, Coord size) { this.offset = offset; this.size = size; }
public static Coord PickCell(Coord c, int cellRes) { return(PickCell(c.x, c.z, cellRes)); }