public void OnRenderObject() { if (stripped) { foreach (LineParticle line in lines) { line.Update(); List <Vector2D> list = new List <Vector2D>(); list.Add(line.GetPair().A); list.Add(line.GetPair().B); Max2D.DrawStrippedLine(list, 1, -2); } } else { foreach (LineParticle line in lines) { line.Update(); List <Vector2D> list = new List <Vector2D>(); list.Add(line.GetPair().A); list.Add(line.GetPair().B); Max2D.DrawLine(line.GetPair().A, line.GetPair().B, -2); } } }
public void OnRenderObject() { if (joint == null || joint.connectedBody == null) { return; } Max2D.SetLineWidth(lineWidth); Max2D.SetColor(color); Max2D.SetSmooth(smooth); Max2D.SetBorder(false); Max2D.DrawLine(new Vector2f(transform.TransformPoint(Vector2.zero)), new Vector2f(joint.connectedBody.transform.TransformPoint(joint.anchor)), transform.position.z + lineOffset); }
public void OnRenderObject() { if (drawSlicer == false) { return; } if (mouseDown) { Max2D.SetBorder(true); Max2D.SetLineMode(Max2D.LineMode.Smooth); Max2D.SetLineWidth(lineWidth * .5f); Max2D.SetColor(slicerColor); Max2D.DrawLineSquare(linearPair.A, 0.5f, zPosition); Max2D.DrawLineSquare(linearPair.B, 0.5f, zPosition); Max2D.DrawLine(linearPair.A, linearPair.B, zPosition); } }
public void OnRenderObject() { if (Camera.current != Camera.main) { return; } foreach (Joint2D joint in joints) { if (joint.gameObject == null) { continue; } if (joint.anchoredJoint2D == null) { continue; } if (joint.anchoredJoint2D.isActiveAndEnabled == false) { continue; } if (joint.anchoredJoint2D.connectedBody == null) { continue; } Max2D.SetLineWidth(lineWidth); Max2D.SetColor(color); Max2D.SetLineMode(Max2D.LineMode.Smooth); Max2D.SetBorder(false); switch (joint.jointType) { case Joint2D.Type.HingeJoint2D: Max2D.DrawLine(new Vector2D(transform.TransformPoint(joint.anchoredJoint2D.anchor)), new Vector2D(joint.anchoredJoint2D.connectedBody.transform.TransformPoint(Vector2.zero)), transform.position.z + lineOffset); break; default: Max2D.DrawLine(new Vector2D(transform.TransformPoint(joint.anchoredJoint2D.anchor)), new Vector2D(joint.anchoredJoint2D.connectedBody.transform.TransformPoint(joint.anchoredJoint2D.connectedAnchor)), transform.position.z + lineOffset); break; } } }
public void OnRenderObject() { Vector2f pos = GetMousePosition(); if (drawSlicer == false) { return; } Max2D.SetBorder(true); Max2D.SetSmooth(true); Max2D.SetLineWidth(lineWidth * .5f); if (mouseDown) { Max2D.SetColor(slicerColor); switch (sliceType) { case SliceType.Complex: if (complexPairs.Count > 0) { Max2D.DrawStrippedLine(complexPairs, minVertsDistance, zPosition); Max2D.DrawLineSquare(complexPairs.Last(), 0.5f, zPosition); Max2D.DrawLineSquare(complexPairs.First(), 0.5f, zPosition); } break; case SliceType.Create: if (createType == CreateType.Slice) { if (complexPairs.Count > 0) { Max2D.DrawStrippedLine(complexPairs, minVertsDistance, zPosition, true); Max2D.DrawLineSquare(complexPairs.Last(), 0.5f, zPosition); Max2D.DrawLineSquare(complexPairs.First(), 0.5f, zPosition); } } else { Max2D.DrawStrippedLine(Polygon.Create(polygonType, polygonSize).pointsList, minVertsDistance, zPosition, true, pos); } break; case SliceType.Linear: Max2D.DrawLine(linearPair.A, linearPair.B, zPosition); Max2D.DrawLineSquare(linearPair.A, 0.5f, zPosition); Max2D.DrawLineSquare(linearPair.B, 0.5f, zPosition); break; case SliceType.Point: break; case SliceType.Explode: break; case SliceType.Polygon: slicePolygon = Polygon.Create(polygonType, polygonSize); Max2D.DrawStrippedLine(slicePolygon.pointsList, minVertsDistance, zPosition, false, pos); break; default: break; } } }
public void OnRenderObject() { Vector2D pos = GetMousePosition(); if (drawSlicer == false) { return; } Max2D.SetBorder(true); Max2D.SetLineMode(Max2D.LineMode.Smooth); Max2D.SetLineWidth(lineWidth * .5f); Max2D.SetScale(visualScale); if (mouseDown) { Max2D.SetColor(slicerColor); switch (sliceType) { case SliceType.Complex: if (complexSlicerPointsList.Count > 0) { if (startSliceIfPossible == false || startedSlice == true) { Max2D.SetColor(Color.black); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.6f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.6f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.4f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.4f * visualScale, zPosition); Max2D.SetColor(slicerColor); Max2D.DrawStrippedLine(complexSlicerPointsList, minVertsDistance, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.5f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.5f * visualScale, zPosition); } } break; case SliceType.ComplexTracked: if (complexSlicerPointsList.Count > 0) { Max2D.DrawLineSquare(pos, 0.5f * visualScale, zPosition); foreach (ComplexSlicerTrackerObject tracker in complexTracker.trackerList) { if (tracker.slicer != null && tracker.tracking) { Max2D.DrawSlice(Vector2DList.ToWorldSpace(tracker.slicer.transform, tracker.pointsList), tracker.slicer.transform.position.z - 0.001f); } } } break; case SliceType.Create: if (createType == CreateType.Slice) { if (complexSlicerPointsList.Count > 0) { Max2D.SetColor(Color.black); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.4f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.4f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.6f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.6f * visualScale, zPosition); Max2D.SetColor(slicerColor); Max2D.DrawLineSquare(complexSlicerPointsList.Last(), 0.5f * visualScale, zPosition); Max2D.DrawLineSquare(complexSlicerPointsList.First(), 0.5f * visualScale, zPosition); Max2D.DrawStrippedLine(complexSlicerPointsList, minVertsDistance, zPosition, true); } } else { Max2D.DrawStrippedLine(Polygon2D.Create(polygonType, polygonSize).pointsList, minVertsDistance, zPosition, true, pos); } break; case SliceType.Linear: Max2D.SetColor(Color.black); Max2D.DrawLineSquare(linearPair.A, 0.6f * visualScale, zPosition); Max2D.DrawLineSquare(linearPair.B, 0.6f * visualScale, zPosition); Max2D.DrawLineSquare(linearPair.A, 0.4f * visualScale, zPosition); Max2D.DrawLineSquare(linearPair.B, 0.4f * visualScale, zPosition); Max2D.SetColor(slicerColor); Max2D.DrawLineSquare(linearPair.A, 0.5f * visualScale, zPosition); Max2D.DrawLineSquare(linearPair.B, 0.5f * visualScale, zPosition); Max2D.DrawLine(linearPair.A, linearPair.B, zPosition); break; case SliceType.LinearCut: linearCutLine = LinearCut.Create(linearPair, linearCutSize); Max2D.DrawStrippedLine(linearCutLine.GetPointsList(), 0, zPosition, true); break; case SliceType.ComplexCut: complexCutLine = ComplexCut.Create(complexSlicerPointsList, complexCutSize); Max2D.DrawStrippedLine(complexCutLine.GetPointsList(), 0, zPosition, true); break; case SliceType.Point: break; case SliceType.Explode: break; case SliceType.Polygon: slicePolygon = Polygon2D.Create(polygonType, polygonSize); Max2D.DrawStrippedLine(slicePolygon.pointsList, minVertsDistance, zPosition, true, pos); break; default: break; } } // Reset Graphics Max2D.SetScale(1f); }