@@ -41,17 +41,30 @@ namespace Ichni.Editor
|
||||
}
|
||||
|
||||
|
||||
public static void Lgp(int loop, Vector3 start, Vector3 end)
|
||||
public static void Lgp(int loop, Vector3 start, Vector3 end, bool Clear = false)
|
||||
{
|
||||
if (inspector.connectedGameElement == null || inspector.connectedGameElement.GetType() != typeof(Track))
|
||||
{
|
||||
LogWindow.Log("Please select a Track first!");
|
||||
return;
|
||||
}
|
||||
if (loop <= 1)
|
||||
{
|
||||
LogWindow.Log("Loop must be greater than 1!");
|
||||
return;
|
||||
}
|
||||
Track track = (Track)inspector.connectedGameElement;
|
||||
if (Clear)
|
||||
{
|
||||
// 清除之前的PathNode
|
||||
foreach (var node in track.trackPathSubmodule.pathNodeList.ToList())
|
||||
{
|
||||
EditorManager.instance.operationManager.CopyPasteDeleteModule.DeleteElement(node);
|
||||
}
|
||||
}
|
||||
for (int i = 0; i < loop; i++)
|
||||
{
|
||||
float t = (float)i / loop;
|
||||
float t = (float)i / (loop - 1); // 修正插值
|
||||
float x = start.x + (end.x - start.x) * t;
|
||||
float y = start.y + (end.y - start.y) * t;
|
||||
float z = start.z + (end.z - start.z) * t;
|
||||
@@ -270,8 +283,18 @@ namespace Ichni.Editor
|
||||
{
|
||||
foreach (var note in noteBases)
|
||||
{
|
||||
note.noteVisual.isHighlighted = false;
|
||||
note.noteVisual.SetHighlight();
|
||||
if (note.noteVisual != null)
|
||||
{
|
||||
note.noteVisual.isHighlighted = false;
|
||||
try
|
||||
{
|
||||
note.noteVisual?.SetHighlight();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -287,8 +310,18 @@ namespace Ichni.Editor
|
||||
{
|
||||
foreach (var note in group)
|
||||
{
|
||||
note.noteVisual.isHighlighted = true;
|
||||
note.noteVisual.SetHighlight();
|
||||
if (note.noteVisual != null)
|
||||
{
|
||||
note.noteVisual.isHighlighted = true;
|
||||
try
|
||||
{
|
||||
note.noteVisual?.SetHighlight();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -303,8 +336,18 @@ namespace Ichni.Editor
|
||||
{
|
||||
foreach (var note in noteBases)
|
||||
{
|
||||
note.noteVisual.isHighlighted = false;
|
||||
note.noteVisual.SetHighlight();
|
||||
if (note.noteVisual != null)
|
||||
{
|
||||
note.noteVisual.isHighlighted = false;
|
||||
try
|
||||
{
|
||||
note.noteVisual?.SetHighlight();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -320,8 +363,19 @@ namespace Ichni.Editor
|
||||
{
|
||||
foreach (var note in group)
|
||||
{
|
||||
note.noteVisual.isHighlighted = true;
|
||||
note.noteVisual.SetHighlight();
|
||||
if (note.noteVisual != null)
|
||||
{
|
||||
note.noteVisual.isHighlighted = true;
|
||||
try
|
||||
{
|
||||
note.noteVisual?.SetHighlight();
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Debug.LogError($"Error setting highlight for note {note.name}: {ex.Message}");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -501,5 +555,6 @@ namespace Ichni.Editor
|
||||
LogWindow.Log("Colped Done!", Color.green);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user