private void ShowAllPathScene() { if (PathPoints.Count < 1) { return; } EditoolsHandle.SetColor(PathColor); for (int j = 0; j < Path.PathPoints.Count; j++) { Path.PathPoints[j] = EditoolsHandle.PositionHandle(Path.PathPoints[j], Quaternion.identity); EditoolsHandle.Label(Path.PathPoints[j] + Vector3.up * 5, $"Point {j + 1}"); EditoolsHandle.SetColor(Color.white); EditoolsHandle.DrawDottedLine(Path.PathPoints[j] + Vector3.up * 5, Path.PathPoints[j], .5f); EditoolsHandle.SetColor(PathColor); EditoolsHandle.DrawSolidDisc(Path.PathPoints[j], Vector3.up, 0.1f); if (j < Path.PathPoints.Count - 1) { EditoolsHandle.DrawLine(Path.PathPoints[j], Path.PathPoints[j + 1]); } } if (GetStartPercentIndex < 0 || GetStartPercentIndex > PathPoints.Count) { return; } EditoolsHandle.DrawDottedLine(PathPoints[GetStartPercentIndex], PathPoints[GetStartPercentIndex] + Vector3.up, 1); EditoolsHandle.Label(PathPoints[GetStartPercentIndex] + Vector3.up, $"Spawn Mark"); }
void ShowAllPathUI() { for (int i = 0; i < eTarget.Paths.Count; i++) { PE_Path path = eTarget.Paths[i]; if (!path.IsEditable) { continue; } EditoolsHandle.SetColor(path.PathColor); for (int j = 0; j < path.PathPoints.Count; j++) { path.PathPoints[j] = EditoolsHandle.PositionHandle(path.PathPoints[j], Quaternion.identity); EditoolsHandle.Label(path.PathPoints[j] + Vector3.up * 5, $"Point {j + 1}"); EditoolsHandle.SetColor(Color.white); EditoolsHandle.DrawDottedLine(path.PathPoints[j] + Vector3.up * 5, path.PathPoints[j], .5f); EditoolsHandle.SetColor(path.PathColor); EditoolsHandle.DrawSolidDisc(path.PathPoints[j], Vector3.up, 0.1f); if (j < path.PathPoints.Count - 1) { EditoolsHandle.DrawLine(path.PathPoints[j], path.PathPoints[j + 1]); } } } }
void DrawSegmentFeedbackOnScene() { Vector3 _currentPosition = Vector3.zero; for (int i = 0; i < Curve.Anchor.Count; i++) { if (i % 3 != 0) { continue; } _currentPosition = Curve.Anchor[i]; EditoolsHandle.DrawDottedLine(_currentPosition, _currentPosition + Vector3.up * 1.5f, 1); EditoolsHandle.Label(_currentPosition + Vector3.up * 1.5f, $"Segment : {i / 3}"); } }
public override void DrawSceneMode() { if (!IsValid || Curve.IsEmpty) { return; } Curve.SetCurve(); for (int j = 0; j < Curve.Anchor.Count; j += 3) { Vector3 _handleA = Curve.Anchor[j]; Vector3 _handleB = Curve.Anchor[j + 1]; Vector3 _handleC = Curve.Anchor[j + 2]; // markers Handles.DrawLine(_handleA, _handleA + Vector3.up * .5f); Handles.DrawLine(_handleB, _handleB + Vector3.up * .5f); Handles.DrawLine(_handleC, _handleC + Vector3.up * .5f); float _sizeA = HandleUtility.GetHandleSize(_handleA); float _sizeB = HandleUtility.GetHandleSize(_handleB); float _sizeC = HandleUtility.GetHandleSize(_handleC); // select Handle bool _pressA = Handles.Button(_handleA + Vector3.up * .05f, Quaternion.identity, .05f * _sizeA, .05f * _sizeA, Handles.DotHandleCap); bool _pressB = Handles.Button(_handleB + Vector3.up * .05f, Quaternion.identity, .05f * _sizeB, .05f * _sizeB, Handles.DotHandleCap); bool _pressC = Handles.Button(_handleC + Vector3.up * .05f, Quaternion.identity, .05f * _sizeC, .05f * _sizeC, Handles.DotHandleCap); if (_pressA) { selectedIndex = j; } if (_pressB) { selectedIndex = j + 1; } if (_pressC) { selectedIndex = j + 2; } if (selectedIndex == j) // if select first point segment { _handleA = Handles.PositionHandle(_handleA, Quaternion.identity); } if (selectedIndex == j + 1) // if select middle segment curve { _handleB = Handles.PositionHandle(_handleB, Quaternion.identity); } if (selectedIndex == j + 2) // if select last segment curve { _handleC = Handles.PositionHandle(_handleC, Quaternion.identity); } Curve.Anchor[j] = _handleA; Curve.Anchor[j + 1] = _handleB; Curve.Anchor[j + 2] = _handleC; // draw linked middle point EditoolsHandle.DrawDottedLine(_handleA, _handleB, .5f); EditoolsHandle.DrawDottedLine(_handleB, _handleC, .5f); } // draw curve DrawCurveOnScene(); // Draw Segment feedback DrawSegmentFeedbackOnScene(); EditoolsHandle.DrawDottedLine(Curve.CurvePoints[Curve.GetStartPercentIndex], Curve.CurvePoints[Curve.GetStartPercentIndex] + Vector3.up * 2, 1); EditoolsHandle.Label(Curve.CurvePoints[Curve.GetStartPercentIndex] + Vector3.up * 2, $"Spawn Mark"); }