CapersProject/Assets/Behavior Designer/Editor/Object Drawers/MoveDrawer.cs
2024-06-04 03:26:03 +09:00

29 lines
1009 B
C#

using BehaviorDesigner.Runtime;
using UnityEngine;
using UnityEditor;
using BlueWater.BehaviorTrees.Enemies.Bosses.Actions;
namespace BehaviorDesigner.Editor.ObjectDrawers
{
[CustomObjectDrawer(typeof(Move))]
public class MoveDrawer : ObjectDrawer
{
public override void OnGUI(GUIContent label)
{
if (Task is not Move moveTask) return;
moveTask.UseMovePosition = EditorGUILayout.Toggle("Use Move Position", moveTask.UseMovePosition);
if (moveTask.UseMovePosition)
{
moveTask.MovePosition = (SharedVector3)FieldInspector.DrawSharedVariable(null,
new GUIContent("Move Position"), null, typeof(SharedVector3), moveTask.MovePosition);
}
else
{
moveTask.Target = (SharedCollider)FieldInspector.DrawSharedVariable(null,
new GUIContent("Target"), null, typeof(SharedCollider), moveTask.Target);
}
}
}
}