コード例 #1
0
        /// <summary>
        /// Clears the data
        /// </summary>
        public void UnloadData()
        {
            m_isManagerAlive = false;

            foreach (var map in m_trackedVoxelMaps)
            {
                map.Value.RangeChanged -= VoxelMapRangeChanged;
            }
            m_trackedVoxelMaps.Clear();

            m_rdWrapper.Clear();
            m_rdWrapper = null;

            m_navInputMesh.Clear();
            m_navInputMesh = null;

            m_navmeshOBBs.Clear();
            m_navmeshOBBs = null;

            m_obbCoordsToUpdate.Clear();
            m_obbCoordsToUpdate = null;

            m_coordsAlreadyGenerated.Clear();
            m_coordsAlreadyGenerated = null;

            m_obbCoordsPolygons.Clear();
            m_obbCoordsPolygons = null;

            m_newObbCoordsPolygons.Clear();
            m_newObbCoordsPolygons = null;

            m_polygons.Clear();
            m_polygons = null;
        }
コード例 #2
0
 public void UnloadData()
 {
     this.m_isManagerAlive = false;
     foreach (KeyValuePair <long, MyVoxelMap> pair in this.m_trackedVoxelMaps)
     {
         pair.Value.RangeChanged -= new MyVoxelBase.StorageChanged(this.VoxelMapRangeChanged);
     }
     this.m_trackedVoxelMaps.Clear();
     this.m_rdWrapper.Clear();
     this.m_rdWrapper = null;
     this.m_navInputMesh.Clear();
     this.m_navInputMesh = null;
     this.m_navmeshOBBs.Clear();
     this.m_navmeshOBBs = null;
     this.m_obbCoordsToUpdate.Clear();
     this.m_obbCoordsToUpdate = null;
     this.m_coordsAlreadyGenerated.Clear();
     this.m_coordsAlreadyGenerated = null;
     this.m_obbCoordsPolygons.Clear();
     this.m_obbCoordsPolygons = null;
     this.m_newObbCoordsPolygons.Clear();
     this.m_newObbCoordsPolygons = null;
     this.m_polygons.Clear();
     this.m_polygons = null;
 }
コード例 #3
0
        public MyNavmeshManager(MyRDPathfinding rdPathfinding, Vector3D center, Vector3D forwardDirection, int tileSize, int tileHeight, int tileLineCount, MyRecastOptions recastOptions)
        {
            Vector3 vector = new Vector3(ran.NextFloat(), ran.NextFloat(), ran.NextFloat());

            vector              -= Math.Min(vector.X, Math.Min(vector.Y, vector.Z));
            vector              /= Math.Max(vector.X, Math.Max(vector.Y, vector.Z));
            this.m_debugColor    = new Color(vector);
            this.m_tileSize      = tileSize;
            this.m_tileHeight    = tileHeight;
            this.m_tileLineCount = tileLineCount;
            this.Planet          = this.GetPlanet(center);
            this.m_heightCoordTransformationIncrease = 0.5f;
            float cellSize = 0.2f;

            this.m_recastOptions = recastOptions;
            float num2 = (this.m_tileSize * 0.5f) + (this.m_tileSize * ((float)Math.Floor((double)(this.m_tileLineCount * 0.5f))));
            float num3 = this.m_tileHeight * 0.5f;

            this.m_border = this.m_recastOptions.agentRadius + (3f * cellSize);
            float[] bMin = new float[] { -num2, -num3, -num2 };
            float[] bMax = new float[] { num2, num3, num2 };
            this.m_rdWrapper = new MyRDWrapper();
            this.m_rdWrapper.Init(cellSize, (float)this.m_tileSize, bMin, bMax);
            Vector3D vectord = Vector3D.CalculatePerpendicularVector(-Vector3D.Normalize(MyGravityProviderSystem.CalculateTotalGravityInPoint(center)));

            this.m_navmeshOBBs   = new MyNavmeshOBBs(this.Planet, center, vectord, this.m_tileLineCount, this.m_tileSize, this.m_tileHeight);
            this.m_debugTileSize = new int?[this.m_tileLineCount][];
            for (int i = 0; i < this.m_tileLineCount; i++)
            {
                this.m_debugTileSize[i] = new int?[this.m_tileLineCount];
            }
            this.m_extendedBaseOBB = new MyOrientedBoundingBoxD(this.m_navmeshOBBs.BaseOBB.Center, new Vector3D(this.m_navmeshOBBs.BaseOBB.HalfExtent.X, (double)this.m_tileHeight, this.m_navmeshOBBs.BaseOBB.HalfExtent.Z), this.m_navmeshOBBs.BaseOBB.Orientation);
            this.m_navInputMesh    = new MyNavigationInputMesh(rdPathfinding, this.Planet, center);
        }
コード例 #4
0
        public MyNavmeshManager(MyRDPathfinding rdPathfinding, Vector3D center, Vector3D forwardDirection, int tileSize, int tileHeight, int tileLineCount, MyRecastOptions recastOptions)
        {
            m_tileSize      = tileSize;
            m_tileHeight    = tileHeight;
            m_tileLineCount = tileLineCount;
            Planet          = GetPlanet(center);

            m_heightCoordTransformationIncrease = 0.5f;

            float cellSize = RECAST_CELL_SIZE;

            m_recastOptions = recastOptions;

            float horizontalOrigin = (m_tileSize * 0.5f + m_tileSize * (float)Math.Floor(m_tileLineCount * 0.5f));
            var   verticalOrigin   = m_tileHeight * 0.5f;

            m_border = m_recastOptions.agentRadius + 3 * cellSize;

            float[] bmin = new float[3] {
                -horizontalOrigin, -verticalOrigin, -horizontalOrigin
            };
            float[] bmax = new float[3] {
                horizontalOrigin, verticalOrigin, horizontalOrigin
            };

            m_rdWrapper = new MyRDWrapper();
            m_rdWrapper.Init(cellSize, m_tileSize, bmin, bmax);

            Vector3D gravityVector = -Vector3D.Normalize(GameSystems.MyGravityProviderSystem.CalculateTotalGravityInPoint(center));
            var      direction     = Vector3D.CalculatePerpendicularVector(gravityVector);

            m_navmeshOBBs   = new MyNavmeshOBBs(Planet, center, direction, m_tileLineCount, m_tileSize, m_tileHeight);
            m_debugTileSize = new int?[m_tileLineCount][];
            for (int i = 0; i < m_tileLineCount; i++)
            {
                m_debugTileSize[i] = new int?[m_tileLineCount];
            }

            m_extendedBaseOBB = new MyOrientedBoundingBoxD(m_navmeshOBBs.BaseOBB.Center,
                                                           new Vector3D(m_navmeshOBBs.BaseOBB.HalfExtent.X, m_tileHeight, m_navmeshOBBs.BaseOBB.HalfExtent.Z),
                                                           m_navmeshOBBs.BaseOBB.Orientation);

            m_navInputMesh = new MyNavigationInputMesh(rdPathfinding, Planet, center);
        }