Pathfinding.LevelGridNode.SetConnectionValue C# (CSharp) Method

SetConnectionValue() public method

public SetConnectionValue ( int dir, int value ) : void
dir int
value int
return void
		public void SetConnectionValue (int dir, int value) {
#if ASTAR_LEVELGRIDNODE_FEW_LAYERS
			gridConnections = (ushort)(gridConnections & ~((ushort)(NoConnection << dir*ConnectionStride)) | (ushort)(value << dir*ConnectionStride));
#else
			gridConnections = gridConnections & ~((uint)(NoConnection << dir*ConnectionStride)) | (uint)(value << dir*ConnectionStride);
#endif
		}
		

Usage Example

        // Token: 0x06002544 RID: 9540 RVA: 0x001A1D88 File Offset: 0x0019FF88
        public void CalculateConnections(int x, int z, int layerIndex)
        {
            LevelGridNode levelGridNode = this.nodes[z * this.width + x + this.width * this.depth * layerIndex];

            if (levelGridNode == null)
            {
                return;
            }
            levelGridNode.ResetAllGridConnections();
            if (!levelGridNode.Walkable)
            {
                return;
            }
            Vector3 vector = (Vector3)levelGridNode.position;
            Vector3 rhs    = base.transform.WorldUpAtGraphPosition(vector);
            float   num    = Vector3.Dot(vector, rhs);
            float   num2;

            if (layerIndex == this.layerCount - 1 || this.nodes[levelGridNode.NodeInGridIndex + this.width * this.depth * (layerIndex + 1)] == null)
            {
                num2 = float.PositiveInfinity;
            }
            else
            {
                num2 = Math.Abs(num - Vector3.Dot((Vector3)this.nodes[levelGridNode.NodeInGridIndex + this.width * this.depth * (layerIndex + 1)].position, rhs));
            }
            for (int i = 0; i < 4; i++)
            {
                int num3 = x + this.neighbourXOffsets[i];
                int num4 = z + this.neighbourZOffsets[i];
                if (num3 >= 0 && num4 >= 0 && num3 < this.width && num4 < this.depth)
                {
                    int num5  = num4 * this.width + num3;
                    int value = 255;
                    for (int j = 0; j < this.layerCount; j++)
                    {
                        GraphNode graphNode = this.nodes[num5 + this.width * this.depth * j];
                        if (graphNode != null && graphNode.Walkable)
                        {
                            float num6 = Vector3.Dot((Vector3)graphNode.position, rhs);
                            float num7;
                            if (j == this.layerCount - 1 || this.nodes[num5 + this.width * this.depth * (j + 1)] == null)
                            {
                                num7 = float.PositiveInfinity;
                            }
                            else
                            {
                                num7 = Math.Abs(num6 - Vector3.Dot((Vector3)this.nodes[num5 + this.width * this.depth * (j + 1)].position, rhs));
                            }
                            float num8 = Mathf.Max(num6, num);
                            if (Mathf.Min(num6 + num7, num + num2) - num8 >= this.characterHeight && Mathf.Abs(num6 - num) <= this.maxClimb)
                            {
                                value = j;
                            }
                        }
                    }
                    levelGridNode.SetConnectionValue(i, value);
                }
            }
        }
All Usage Examples Of Pathfinding.LevelGridNode::SetConnectionValue