加一个判断条件

This commit is contained in:
2025-07-17 17:03:57 +08:00
parent d1bd2aeff3
commit fc3b4d7207
4 changed files with 198 additions and 191 deletions

View File

@@ -24,7 +24,7 @@ namespace Ichni.RhythmGame
public Vector3 currentPosition;
public Vector3 currentEulerAngles;
public Vector3 currentScale;
public bool positionDirtyMark;
public bool eulerAnglesDirtyMark;
public bool scaleDirtyMark;
@@ -41,7 +41,7 @@ namespace Ichni.RhythmGame
positionOffset = Vector3.zero;
eulerAnglesOffset = Vector3.zero;
scaleOffset = Vector3.zero;
currentPosition = Vector3.zero;
currentEulerAngles = Vector3.zero;
currentScale = Vector3.one;
@@ -69,7 +69,7 @@ namespace Ichni.RhythmGame
positionOffset = Vector3.zero;
eulerAnglesOffset = Vector3.zero;
scaleOffset = Vector3.zero;
currentPosition = originalPosition;
currentEulerAngles = originalEulerAngles;
currentScale = originalScale;
@@ -99,7 +99,7 @@ namespace Ichni.RhythmGame
public override void SetUpInspector()
{
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
var container = inspector.GenerateContainer("Transform");
var subcontainer = container.GenerateSubcontainer(1);
var originalPosInputField =
@@ -108,20 +108,20 @@ namespace Ichni.RhythmGame
inspector.GenerateVector3InputField(this, subcontainer, "Start Rotation", nameof(originalEulerAngles));
var originalScaleInputField =
inspector.GenerateVector3InputField(this, subcontainer, "Start Scale", nameof(originalScale));
var currentPosText =
var currentPosText =
inspector.GenerateParameterText(this, subcontainer, "Current Position", nameof(currentPosition), true);
var currentRotText =
inspector.GenerateParameterText(this, subcontainer, "Current Rotation", nameof(currentEulerAngles), true);
if (attachedGameElement is PathNode or Trail) // 如果是PathNode显示法线方向
{
var currentNormalText =
inspector.GenerateHintText(this, subcontainer, () => "Normal: " + attachedGameElement.transform.forward);
}
var currentScaleText =
var currentScaleText =
inspector.GenerateParameterText(this, subcontainer, "Current Scale", nameof(currentScale), true);
originalPosInputField.AddListenerFunction(Refresh);
originalRotInputField.AddListenerFunction(Refresh);
originalScaleInputField.AddListenerFunction(Refresh);
@@ -153,7 +153,7 @@ namespace Ichni.RhythmGame
{
return;
}
bool willRefresh = false;
if (transformSubmodule.scaleDirtyMark)
@@ -182,20 +182,20 @@ namespace Ichni.RhythmGame
willRefresh = true;
transformSubmodule.positionOffset = Vector3.zero;
}
if(willRefresh)
if (willRefresh)
{
attachedGameElement.Refresh();
}
}).AddTo(attachedGameElement);
}
public void UpdateLookAt(LookAt lookAt) // 处理LookAt
{
Transform target = lookAt.lookAtObject.transform;
Transform self = transformSubmodule.attachedGameElement.transform;
if (transformSubmodule.eulerAnglesOffsetLock && transformSubmodule.eulerAnglesDirtyMark)
{
Vector3 lookingDirection = (target.position - self.position).normalized;
@@ -204,7 +204,7 @@ namespace Ichni.RhythmGame
transformSubmodule.eulerAnglesOffset += eulerAnglesOffset;
transformSubmodule.currentEulerAngles = transformSubmodule.originalEulerAngles + transformSubmodule.eulerAnglesOffset;
self.localEulerAngles = transformSubmodule.currentEulerAngles;
transformSubmodule.eulerAnglesDirtyMark = false;