public void TryClearCell(ulong packedCoord)
        {
            if (m_triangleLists.ContainsKey(packedCoord))
            {
                ClearCachedCell(packedCoord);
            }

            RemoveExplored(packedCoord);

            MyNavmeshComponents.CellInfo cellInfo;
            if (!m_navmeshComponents.TryGetCell(packedCoord, out cellInfo))
            {
                return;
            }

            for (int i = 0; i < cellInfo.ComponentNum; ++i)
            {
                int componentIndex = cellInfo.StartingIndex + i;
                m_mesh.HighLevelGroup.RemovePrimitive(componentIndex);
            }

            foreach (var direction in Base6Directions.EnumDirections)
            {
                Base6Directions.DirectionFlags dirFlag = Base6Directions.GetDirectionFlag(direction);
                if (cellInfo.ExploredDirections.HasFlag(dirFlag))
                {
                    Vector3I dirVec = Base6Directions.GetIntVector(direction);

                    MyCellCoord otherCoord = new MyCellCoord();
                    otherCoord.SetUnpack(packedCoord);
                    Debug.Assert(otherCoord.Lod == MyVoxelNavigationMesh.NAVMESH_LOD);
                    otherCoord.CoordInLod = otherCoord.CoordInLod + dirVec;

                    MyNavmeshComponents.CellInfo otherCellInfo;

                    if (m_navmeshComponents.TryGetCell(otherCoord.PackId64(), out otherCellInfo))
                    {
                        Base6Directions.DirectionFlags flippedFlag = Base6Directions.GetDirectionFlag(Base6Directions.GetFlippedDirection(direction));
                        m_navmeshComponents.SetExplored(otherCoord.PackId64(), otherCellInfo.ExploredDirections & ~flippedFlag);
                    }
                    else
                    {
                        Debug.Assert(false, "Could not get the oposite explored cell!");
                    }
                }
            }

            m_navmeshComponents.ClearCell(packedCoord, ref cellInfo);
        }
Exemple #2
0
        private void TryClearCell(ulong packedCoord)
        {
            MyNavmeshComponents.CellInfo cellInfo;
            if (!m_components.TryGetCell(packedCoord, out cellInfo))
            {
                return;
            }

            /*for (int i = 0; i < cellInfo.ComponentNum; ++i)
             * {
             *  int componentIndex = cellInfo.StartingIndex + i;
             *  m_mesh.HighLevelGroup.RemovePrimitive(componentIndex);
             * }*/

            m_components.ClearCell(packedCoord, ref cellInfo);
        }