Exemplo n.º 1
0
        internal NavmeshTileData GetTileData(int x, int z, out int polyCount)
        {
            polyCount = 0;

            int i = GetIndex(x, z);

            if (i == IndexError)
            {
                return(null);
            }

            BuildDataItem item = unsafeItems[i];

            /*
             * Important: Must use the state. This method must return
             * the same number of tiles as the BakeableCount method indicates.
             */

            switch (item.TileState)
            {
            case TileBuildState.Built:

                polyCount = item.workingPolyCount;
                return(NavmeshTileData.Create(item.workingTile));

            case TileBuildState.Baked:

                polyCount = item.bakedPolyCount;
                return(NavmeshTileData.Create(item.bakedTile));
            }

            polyCount = 0;
            return(null);
        }
Exemplo n.º 2
0
        internal void Resize(int width, int depth)
        {
            unsafeWidth = System.Math.Max(0, width);
            unsafeDepth = System.Math.Max(0, depth);
            unsafeItems = new BuildDataItem[unsafeWidth * unsafeDepth];

            for (int tx = 0; tx < unsafeWidth; tx++)
            {
                for (int tz = 0; tz < unsafeDepth; tz++)
                {
                    unsafeItems[GetIndex(tx, tz)] = new BuildDataItem(tx, tz);
                }
            }

            mIsDirty = true;
            unsafeVersion++;
        }
Exemplo n.º 3
0
        internal PolyMeshDetail GetDetailMesh(int x, int z)
        {
            int i = GetIndex(x, z);

            if (i == IndexError)
            {
                return(null);
            }

            BuildDataItem item = unsafeItems[i];

            if (item.detailMesh.Length == 0)
            {
                return(null);
            }

            return(PolyMeshDetail.Create(item.detailMesh));
        }
        internal void Resize(int width, int depth)
        {
            unsafeWidth = System.Math.Max(0, width);
            unsafeDepth = System.Math.Max(0, depth);
            unsafeItems = new BuildDataItem[unsafeWidth * unsafeDepth];

            for (int tx = 0; tx < unsafeWidth; tx++)
            {
                for (int tz = 0; tz < unsafeDepth; tz++)
                {
                    unsafeItems[GetIndex(tx, tz)] = new BuildDataItem(tx, tz);
                }
            }

            mIsDirty = true;
            unsafeVersion++;
        }