示例#1
0
        public Layer(Point <int> min, Point <int> max)
        {
            var tmpMin = new Point <int>(Math.Min(min.x, max.x), Math.Min(min.y, max.y));
            var tmpMax = new Point <int>(Math.Max(min.x, max.x), Math.Max(min.y, max.y));

            this.min  = tmpMin;
            this.size = PointUtil.Add(PointUtil.Subtract(tmpMax, tmpMin), 1);

            tiles = new T[size.x, size.y];
        }
示例#2
0
        public Point <int> Find(T item)
        {
            var retval = PointUtil.Subtract(min, -1);

            for (var y = size.y - 1; y >= 0; --y)
            {
                for (var x = 0; x < size.x; ++x)
                {
                    if (tiles[x, y].Equals(item))
                    {
                        return(PointUtil.Add(new Point <int>(x, y), min));
                    }
                }
            }
            return(retval);
        }