CapersProject/Assets/Behavior Designer/Editor/Object Drawers/MoveDrawer.cs

29 lines
1009 B
C#
Raw Normal View History

2024-06-03 18:26:03 +00:00
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);
}
}
}
}