IsValid() public method

public IsValid ( ) : bool
return bool
Exemplo n.º 1
0
        protected override List <GraphNode> GetNodesInRegion(Bounds b, GraphUpdateShape shape)
        {
            IntRect rectFromBounds = base.GetRectFromBounds(b);

            if (this.nodes == null || !rectFromBounds.IsValid() || this.nodes.Length != this.width * this.depth * this.layerCount)
            {
                return(ListPool <GraphNode> .Claim());
            }
            List <GraphNode> list = ListPool <GraphNode> .Claim(rectFromBounds.Width *rectFromBounds.Height *this.layerCount);

            for (int i = 0; i < this.layerCount; i++)
            {
                int num = i * this.width * this.depth;
                for (int j = rectFromBounds.xmin; j <= rectFromBounds.xmax; j++)
                {
                    for (int k = rectFromBounds.ymin; k <= rectFromBounds.ymax; k++)
                    {
                        int       num2      = num + k * this.width + j;
                        GraphNode graphNode = this.nodes[num2];
                        if (graphNode != null && b.Contains((Vector3)graphNode.position) && (shape == null || shape.Contains((Vector3)graphNode.position)))
                        {
                            list.Add(graphNode);
                        }
                    }
                }
            }
            return(list);
        }
Exemplo n.º 2
0
        public override List <GraphNode> GetNodesInRegion(IntRect rect)
        {
            List <GraphNode> list = ListPool <GraphNode> .Claim();

            IntRect b = new IntRect(0, 0, this.width - 1, this.depth - 1);

            rect = IntRect.Intersection(rect, b);
            if (this.nodes == null || !rect.IsValid() || this.nodes.Length != this.width * this.depth * this.layerCount)
            {
                return(list);
            }
            for (int i = 0; i < this.layerCount; i++)
            {
                int num = i * base.Width * base.Depth;
                for (int j = rect.ymin; j <= rect.ymax; j++)
                {
                    int num2 = num + j * base.Width;
                    for (int k = rect.xmin; k <= rect.xmax; k++)
                    {
                        LevelGridNode levelGridNode = this.nodes[num2 + k];
                        if (levelGridNode != null)
                        {
                            list.Add(levelGridNode);
                        }
                    }
                }
            }
            return(list);
        }
Exemplo n.º 3
0
        public override int GetNodesInRegion(IntRect rect, GridNodeBase[] buffer)
        {
            IntRect b = new IntRect(0, 0, this.width - 1, this.depth - 1);

            rect = IntRect.Intersection(rect, b);
            if (this.nodes == null || !rect.IsValid() || this.nodes.Length != this.width * this.depth * this.layerCount)
            {
                return(0);
            }
            int num = 0;

            try
            {
                for (int i = 0; i < this.layerCount; i++)
                {
                    int num2 = i * base.Width * base.Depth;
                    for (int j = rect.ymin; j <= rect.ymax; j++)
                    {
                        int num3 = num2 + j * base.Width;
                        for (int k = rect.xmin; k <= rect.xmax; k++)
                        {
                            LevelGridNode levelGridNode = this.nodes[num3 + k];
                            if (levelGridNode != null)
                            {
                                buffer[num] = levelGridNode;
                                num++;
                            }
                        }
                    }
                }
            }
            catch (IndexOutOfRangeException)
            {
                throw new ArgumentException("Buffer is too small");
            }
            return(num);
        }