去掉obi,使用自写绳索
This commit is contained in:
57
Assets/Scripts/Editor/RopeEditor.cs
Normal file
57
Assets/Scripts/Editor/RopeEditor.cs
Normal file
@@ -0,0 +1,57 @@
|
||||
using UnityEditor;
|
||||
using UnityEngine;
|
||||
|
||||
[CustomEditor(typeof(Rope))]
|
||||
public class RopeFishLineEditor : Editor
|
||||
{
|
||||
private Rope _target;
|
||||
|
||||
void OnEnable()
|
||||
{
|
||||
_target = target as Rope;
|
||||
// lookAtPoint = serializedObject.FindProperty("lookAtPoint");
|
||||
}
|
||||
|
||||
public override void OnInspectorGUI()
|
||||
{
|
||||
base.OnInspectorGUI();
|
||||
if (GUILayout.Button("增加0.5长度"))
|
||||
{
|
||||
_target.AddTargetLength(0.5f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("减小0.5长度"))
|
||||
{
|
||||
_target.AddTargetLength(-0.5f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("增加0.1长度"))
|
||||
{
|
||||
_target.AddTargetLength(0.1f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("减小0.1长度"))
|
||||
{
|
||||
_target.AddTargetLength(-0.1f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("增加0.01长度"))
|
||||
{
|
||||
_target.AddTargetLength(0.01f);
|
||||
}
|
||||
|
||||
if (GUILayout.Button("减小0.01长度"))
|
||||
{
|
||||
_target.AddTargetLength(-0.01f);
|
||||
}
|
||||
|
||||
|
||||
if (GUILayout.Button("打印总长度"))
|
||||
{
|
||||
Debug.Log($"总长度={_target.GetCurrentLength()} 目标长度={_target.GetTargetLength()}");
|
||||
}
|
||||
// serializedObject.Update();
|
||||
// EditorGUILayout.PropertyField(lookAtPoint);
|
||||
// serializedObject.ApplyModifiedProperties();
|
||||
}
|
||||
}
|
||||
3
Assets/Scripts/Editor/RopeEditor.cs.meta
Normal file
3
Assets/Scripts/Editor/RopeEditor.cs.meta
Normal file
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f24add4ba0ae4e76acd98c4a5512c366
|
||||
timeCreated: 1771850618
|
||||
Reference in New Issue
Block a user