Exemple #1
0
 public bool Equals(MoveId other)
 {
     return(position.Equals(other.position) && direction.Equals(other.direction));
 }
Exemple #2
0
 public override unsafe void DebugDraw(ref Matrix drawMatrix)
 {
     if (MyFakes.DEBUG_DRAW_NAVMESH_PROCESSED_VOXEL_CELLS)
     {
         Vector3 vector  = Vector3.TransformNormal(this.m_cellSize, (Matrix)drawMatrix);
         Vector3 vector2 = Vector3.Transform((Vector3)(this.m_voxelMap.PositionLeftBottomCorner - this.m_voxelMap.PositionComp.GetPosition()), (Matrix)drawMatrix);
         foreach (Vector3I vectori in this.m_processedCells)
         {
             BoundingBoxD xd;
             xd.Min = vector2 + (vector * (new Vector3(0.0625f) + vectori));
             BoundingBoxD *xdPtr1 = (BoundingBoxD *)ref xd;
             xdPtr1->Max = xd.Min + vector;
             xd.Inflate((double)-0.20000000298023224);
             MyRenderProxy.DebugDrawAABB(xd, Color.Orange, 1f, 1f, false, false, false);
             MyRenderProxy.DebugDrawText3D(xd.Center, vectori.ToString(), Color.Orange, 0.5f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false);
         }
     }
     if (MyFakes.DEBUG_DRAW_NAVMESH_CELLS_ON_PATHS)
     {
         Vector3     vector3 = Vector3.TransformNormal(this.m_cellSize, (Matrix)drawMatrix);
         Vector3     vector4 = Vector3.Transform((Vector3)(this.m_voxelMap.PositionLeftBottomCorner - this.m_voxelMap.PositionComp.GetPosition()), (Matrix)drawMatrix);
         MyCellCoord coord   = new MyCellCoord();
         foreach (ulong num in this.m_cellsOnWayCoords)
         {
             BoundingBoxD xd2;
             coord.SetUnpack(num);
             Vector3I coordInLod = coord.CoordInLod;
             xd2.Min = vector4 + (vector3 * (new Vector3(0.0625f) + coordInLod));
             BoundingBoxD *xdPtr2 = (BoundingBoxD *)ref xd2;
             xdPtr2->Max = xd2.Min + vector3;
             xd2.Inflate((double)-0.30000001192092896);
             MyRenderProxy.DebugDrawAABB(xd2, Color.Green, 1f, 1f, false, false, false);
         }
     }
     if (MyFakes.DEBUG_DRAW_NAVMESH_PREPARED_VOXEL_CELLS)
     {
         Vector3  vector5          = Vector3.TransformNormal(this.m_cellSize, (Matrix)drawMatrix);
         Vector3  vector6          = Vector3.Transform((Vector3)(this.m_voxelMap.PositionLeftBottomCorner - this.m_voxelMap.PositionComp.GetPosition()), (Matrix)drawMatrix);
         float    negativeInfinity = float.NegativeInfinity;
         Vector3I zero             = Vector3I.Zero;
         int      index            = 0;
         while (true)
         {
             if (index >= this.m_toAdd.Count)
             {
                 for (int i = 0; i < this.m_toAdd.Count; i++)
                 {
                     BoundingBoxD      xd3;
                     CellToAddHeapItem local1   = this.m_toAdd.GetItem(i);
                     float             num6     = local1.HeapKey;
                     Vector3I          position = local1.Position;
                     xd3.Min = vector6 + (vector5 * (new Vector3(0.0625f) + position));
                     BoundingBoxD *xdPtr3 = (BoundingBoxD *)ref xd3;
                     xdPtr3->Max = xd3.Min + vector5;
                     xd3.Inflate((double)-0.10000000149011612);
                     Color aqua = Color.Aqua;
                     if (position.Equals(zero))
                     {
                         aqua = Color.Red;
                     }
                     MyRenderProxy.DebugDrawAABB(xd3, aqua, 1f, 1f, false, false, false);
                     string text = $"{num6.ToString("n2")}";
                     MyRenderProxy.DebugDrawText3D(xd3.Center, text, aqua, 0.7f, false, MyGuiDrawAlignEnum.HORISONTAL_LEFT_AND_VERTICAL_TOP, -1, false);
                 }
                 break;
             }
             CellToAddHeapItem item    = this.m_toAdd.GetItem(index);
             float             heapKey = item.HeapKey;
             if (heapKey > negativeInfinity)
             {
                 negativeInfinity = heapKey;
                 zero             = item.Position;
             }
             index++;
         }
     }
     MyRenderProxy.DebugDrawSphere(this.m_debugPos1, 0.2f, Color.Red, 1f, false, false, true, false);
     MyRenderProxy.DebugDrawSphere(this.m_debugPos2, 0.2f, Color.Green, 1f, false, false, true, false);
     MyRenderProxy.DebugDrawSphere(this.m_debugPos3, 0.1f, Color.Red, 1f, false, false, true, false);
     MyRenderProxy.DebugDrawSphere(this.m_debugPos4, 0.1f, Color.Green, 1f, false, false, true, false);
     if (MyFakes.DEBUG_DRAW_VOXEL_CONNECTION_HELPER)
     {
         this.m_connectionHelper.DebugDraw(ref drawMatrix, base.Mesh);
     }
     if (MyFakes.DEBUG_DRAW_NAVMESH_CELL_BORDERS)
     {
         foreach (KeyValuePair <ulong, List <DebugDrawEdge> > pair in this.m_debugCellEdges)
         {
             foreach (DebugDrawEdge edge in pair.Value)
             {
                 MyRenderProxy.DebugDrawLine3D(edge.V1, edge.V2, Color.Orange, Color.Orange, false, false);
             }
         }
     }
     else
     {
         this.m_debugCellEdges.Clear();
     }
     if (MyFakes.DEBUG_DRAW_NAVMESH_HIERARCHY)
     {
         if (MyFakes.DEBUG_DRAW_NAVMESH_HIERARCHY_LITE)
         {
             this.m_higherLevel.DebugDraw(true);
         }
         else
         {
             this.m_higherLevel.DebugDraw(false);
             this.m_higherLevelHelper.DebugDraw();
         }
     }
     if ((MyDebugDrawSettings.DEBUG_DRAW_NAVMESHES == MyWEMDebugDrawMode.LINES) && !(this.m_voxelMap is MyVoxelPhysics))
     {
         int num7 = 0;
         MyWingedEdgeMesh.EdgeEnumerator edges = base.Mesh.GetEdges(null);
         Vector3D position = this.m_voxelMap.PositionComp.GetPosition();
         while (edges.MoveNext())
         {
             MyWingedEdgeMesh.Edge current = edges.Current;
             Vector3D vectord2             = base.Mesh.GetVertexPosition(current.Vertex2) + position;
             Vector3D point = ((base.Mesh.GetVertexPosition(edges.Current.Vertex1) + position) + vectord2) * 0.5;
             if (MyCestmirPathfindingShorts.Pathfinding.Obstacles.IsInObstacle(point))
             {
                 MyRenderProxy.DebugDrawSphere(point, 0.05f, Color.Red, 1f, false, false, true, false);
             }
             num7++;
         }
     }
 }
        public void TestEquals()
        {
            Vector3I a = new Vector3I(1, 2, 3);
            Vector3I b = new Vector3I(4, 5, 6);
            Vector3I c = new Vector3I(1, 2, 3);

            Assert.IsTrue(a.Equals(c));
            Assert.IsTrue(c.Equals(a));
            Assert.IsTrue(a == c);
            Assert.IsTrue(c == a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(c != a);
            Assert.IsFalse(a.Equals(b));
            Assert.IsFalse(b.Equals(a));
            Assert.IsFalse(a == b);
            Assert.IsFalse(b == a);
            Assert.IsTrue(a != b);
            Assert.IsTrue(b != a);

            object objA = a;
            object objB = b;
            object objC = c;

            Assert.IsTrue(a.Equals(objA));
            Assert.IsTrue(a.Equals(objC));
            Assert.IsFalse(a.Equals(objB));

            Assert.IsTrue(objA.Equals(objC));
            Assert.IsFalse(objA.Equals(objB));

            Assert.IsFalse(a.Equals(null));
            Assert.IsFalse(a.Equals(5));
        }