示例#1
0
 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; }
 }
示例#2
0
 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);
 }
示例#3
0
 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);
 }
示例#4
0
 public CoordRect(Rect r)
 {
     offset = new Coord((int)r.x, (int)r.y); size = new Coord((int)r.width, (int)r.height);
 }
示例#5
0
 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);
 }
示例#6
0
 public CoordRect(int offsetX, int offsetZ, int sizeX, int sizeZ)
 {
     this.offset = new Coord(offsetX, offsetZ); this.size = new Coord(sizeX, sizeZ);
 }
示例#7
0
        //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;
        }
示例#8
0
 public static Coord PickCell(Coord c, int cellRes)
 {
     return(PickCell(c.x, c.z, cellRes));
 }