UpdateArea() public method

public UpdateArea ( GraphUpdateObject o ) : void
o GraphUpdateObject
return void
Exemplo n.º 1
0
        void IUpdatableGraph.UpdateArea(GraphUpdateObject guo)
        {
            // Figure out which tiles are affected
            // Expand TileBorderSizeInWorldUnits voxels in all directions to make sure
            // all tiles that could be affected by the update are recalculated.
            var affectedTiles = GetTouchingTiles(guo.bounds, TileBorderSizeInWorldUnits);

            if (!guo.updatePhysics)
            {
                for (int z = affectedTiles.ymin; z <= affectedTiles.ymax; z++)
                {
                    for (int x = affectedTiles.xmin; x <= affectedTiles.xmax; x++)
                    {
                        NavmeshTile tile = tiles[z * tileXCount + x];
                        NavMeshGraph.UpdateArea(guo, tile);
                    }
                }
                return;
            }

            Voxelize vox = globalVox;

            if (vox == null)
            {
                throw new System.InvalidOperationException("No Voxelizer object. UpdateAreaInit should have been called before this function.");
            }

            AstarProfiler.StartProfile("Build Tiles");

            // Build the new tiles
            for (int x = affectedTiles.xmin; x <= affectedTiles.xmax; x++)
            {
                for (int z = affectedTiles.ymin; z <= affectedTiles.ymax; z++)
                {
                    stagingTiles.Add(BuildTileMesh(vox, x, z));
                }
            }

            uint graphIndex = (uint)AstarPath.active.data.GetGraphIndex(this);

            // Set the correct graph index
            for (int i = 0; i < stagingTiles.Count; i++)
            {
                NavmeshTile tile  = stagingTiles[i];
                GraphNode[] nodes = tile.nodes;

                for (int j = 0; j < nodes.Length; j++)
                {
                    nodes[j].GraphIndex = graphIndex;
                }
            }

            for (int i = 0; i < vox.inputMeshes.Count; i++)
            {
                vox.inputMeshes[i].Pool();
            }
            ListPool <RasterizationMesh> .Release(ref vox.inputMeshes);

            AstarProfiler.EndProfile("Build Tiles");
        }
Exemplo n.º 2
0
        void IUpdatableGraph.UpdateArea(GraphUpdateObject guo)
        {
            IntRect touchingTiles = base.GetTouchingTiles(guo.bounds);

            if (!guo.updatePhysics)
            {
                for (int i = touchingTiles.ymin; i <= touchingTiles.ymax; i++)
                {
                    for (int j = touchingTiles.xmin; j <= touchingTiles.xmax; j++)
                    {
                        NavmeshTile graph = this.tiles[i * this.tileXCount + j];
                        NavMeshGraph.UpdateArea(guo, graph);
                    }
                }
                return;
            }
            Voxelize voxelize = this.globalVox;

            if (voxelize == null)
            {
                throw new InvalidOperationException("No Voxelizer object. UpdateAreaInit should have been called before this function.");
            }
            for (int k = touchingTiles.xmin; k <= touchingTiles.xmax; k++)
            {
                for (int l = touchingTiles.ymin; l <= touchingTiles.ymax; l++)
                {
                    this.stagingTiles.Add(this.BuildTileMesh(voxelize, k, l, 0));
                }
            }
            uint graphIndex = (uint)AstarPath.active.data.GetGraphIndex(this);

            for (int m = 0; m < this.stagingTiles.Count; m++)
            {
                NavmeshTile navmeshTile = this.stagingTiles[m];
                GraphNode[] nodes       = navmeshTile.nodes;
                for (int n = 0; n < nodes.Length; n++)
                {
                    nodes[n].GraphIndex = graphIndex;
                }
            }
            for (int num = 0; num < voxelize.inputMeshes.Count; num++)
            {
                voxelize.inputMeshes[num].Pool();
            }
            ListPool <RasterizationMesh> .Release(voxelize.inputMeshes);

            voxelize.inputMeshes = null;
        }
Exemplo n.º 3
0
 public void UpdateArea(GraphUpdateObject o)
 {
     NavMeshGraph.UpdateArea(o, this);
 }
Exemplo n.º 4
0
 // Token: 0x0600256F RID: 9583 RVA: 0x001A2E2C File Offset: 0x001A102C
 void IUpdatableGraph.UpdateArea(GraphUpdateObject o)
 {
     NavMeshGraph.UpdateArea(o, this);
 }