@@ -3,6 +3,8 @@ using UnityEngine;
|
||||
using Ichni.RhythmGame;
|
||||
using UnityEngine.InputSystem;
|
||||
using DG.Tweening;
|
||||
using UniRx;
|
||||
using UniRx.Triggers;
|
||||
|
||||
namespace Ichni.Editor
|
||||
{
|
||||
@@ -46,12 +48,19 @@ namespace Ichni.Editor
|
||||
transform.localScale = Vector3.zero;
|
||||
StartCoroutine(WindowAnim.ShowPanelOnScale(gameObject));
|
||||
|
||||
targetGameElement.OnDestroyAsObservable()
|
||||
.Subscribe(_ =>
|
||||
{
|
||||
if (gameObject != null) Destroy(gameObject);
|
||||
instance = null;
|
||||
});
|
||||
}
|
||||
|
||||
void Update()
|
||||
{
|
||||
if (isMoving) return;
|
||||
|
||||
if (isMoving) return;
|
||||
transform.eulerAngles = targetGameElement.parentElement?.transform.eulerAngles ?? Vector3.zero;
|
||||
transform.position = targetGameElement.transform.position;
|
||||
if (Mouse.current.leftButton.wasPressedThisFrame)
|
||||
{
|
||||
@@ -144,13 +153,14 @@ namespace Ichni.Editor
|
||||
|
||||
// 应用新位置
|
||||
Vector3 newPosition = initialTargetPosition + worldAxis * worldDelta;
|
||||
Vector3 newPositionFormatted = new Vector3(
|
||||
Mathf.Round(newPosition.x * 100f) / 100f,
|
||||
Mathf.Round(newPosition.y * 100f) / 100f,
|
||||
Mathf.Round(newPosition.z * 100f) / 100f
|
||||
|
||||
targetGameElement.transform.position = newPosition;
|
||||
targetGameElement.transform.localPosition = new Vector3(
|
||||
Mathf.Round(targetGameElement.transform.localPosition.x * 100f) / 100f,
|
||||
Mathf.Round(targetGameElement.transform.localPosition.y * 100f) / 100f,
|
||||
Mathf.Round(targetGameElement.transform.localPosition.z * 100f) / 100f
|
||||
);
|
||||
targetGameElement.transform.position = newPositionFormatted;
|
||||
transform.position = newPositionFormatted;
|
||||
transform.position = newPosition;
|
||||
}
|
||||
|
||||
private Vector3 GetWorldAxis(int moveCode)
|
||||
|
||||
Reference in New Issue
Block a user