Skip to content

Commit

Permalink
Fix Pro Manual Activate Bug
Browse files Browse the repository at this point in the history
Fix Pro Manual Activate Bug
  • Loading branch information
AkiKurisu committed Jul 26, 2023
1 parent 286d9e5 commit df401d4
Show file tree
Hide file tree
Showing 8 changed files with 219 additions and 174 deletions.
18 changes: 9 additions & 9 deletions Editor/Core/GOAPPlannerEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,31 +4,31 @@
using UnityEngine.UIElements;
namespace Kurisu.GOAP.Editor
{
[CustomEditor(typeof(GOAPPlanner),true)]
[CustomEditor(typeof(GOAPPlanner), true)]
public class GOAPPlannerEditor : UnityEditor.Editor
{
private const string LabelText="AkiGOAP <size=12>V1.0</size> Planner";
private const string ButtonText="Open Planner Snapshot";
private const string GraphButtonText="Open GOAP Editor";
private const string LabelText = "AkiGOAP <size=12>V1.0</size> Planner";
private const string ButtonText = "Open Planner Snapshot";
private const string GraphButtonText = "Open GOAP Editor";
public override VisualElement CreateInspectorGUI()
{
var myInspector = new VisualElement();
myInspector.Add(UIUtility.GetLabel(LabelText,20));
myInspector.Add(UIUtility.GetLabel(LabelText, 20));
InspectorElement.FillDefaultInspector(myInspector, serializedObject, this);
myInspector.Remove(myInspector.Q<PropertyField>("PropertyField:m_Script"));
//Setting
myInspector.AddSpace();
UIUtility.GetLabel("Normal Setting",14,color:UIUtility.AkiBlue,anchor:TextAnchor.MiddleLeft).AddTo(myInspector);
UIUtility.GetLabel("Normal Setting", 14, color: UIUtility.AkiBlue, anchor: TextAnchor.MiddleLeft).AddTo(myInspector);
myInspector.Q<PropertyField>("PropertyField:logType").MoveToEnd(myInspector);
myInspector.Q<PropertyField>("PropertyField:tickType").MoveToEnd(myInspector);
//SnapShot
UIUtility.GetButton(ButtonText,UIUtility.AkiRed,ShowPlannerWindow,100)
UIUtility.GetButton(ButtonText, UIUtility.AkiRed, ShowPlannerWindow, 100)
.Enabled(Application.isPlaying)
.AddTo(myInspector);
//Editor
UIUtility.GetButton(GraphButtonText,UIUtility.AkiBlue,ShowGOAPEditor,100)
UIUtility.GetButton(GraphButtonText, UIUtility.AkiBlue, ShowGOAPEditor, 100)
.Enabled(Application.isPlaying)
.AddTo(myInspector);
.AddTo(myInspector);
return myInspector;
}
private void ShowPlannerWindow()
Expand Down
33 changes: 19 additions & 14 deletions Editor/Core/GOAPPlannerProEditor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,42 +4,47 @@
using UnityEngine.UIElements;
namespace Kurisu.GOAP.Editor
{
[CustomEditor(typeof(GOAPPlannerPro),true)]
[CustomEditor(typeof(GOAPPlannerPro), true)]
public class GOAPPlannerProEditor : UnityEditor.Editor
{
private const string LabelText="AkiGOAP <size=12>V1.0</size> Planner Pro";
private const string ButtonText="Open Planner Snapshot";
private const string GraphButtonText="Open GOAP Editor";
private const string SkilSearchTooltip="Enabled to skip search plan when already have an action, toggle this will need you to set correct precondition"+
private const string LabelText = "AkiGOAP <size=12>V1.0</size> Planner Pro";
private const string ButtonText = "Open Planner Snapshot";
private const string GraphButtonText = "Open GOAP Editor";
private const string SkilSearchTooltip = "Enabled to skip search plan when already have an action, toggle this will need you to set correct precondition" +
"for each action to let it quit by itself";
public override VisualElement CreateInspectorGUI()
{
var myInspector = new VisualElement();
myInspector.Add(UIUtility.GetLabel(LabelText,20));
myInspector.Add(UIUtility.GetLabel(LabelText, 20));
//Default
InspectorElement.FillDefaultInspector(myInspector, serializedObject, this);
myInspector.Remove(myInspector.Q<PropertyField>("PropertyField:m_Script"));
myInspector.Remove(myInspector.Q<PropertyField>("PropertyField:skipSearchWhenActionRunning"));
myInspector.Remove(myInspector.Q<PropertyField>("PropertyField:isActive"));
//Setting
myInspector.AddSpace();
UIUtility.GetLabel("Normal Setting",14,color:UIUtility.AkiBlue,anchor:TextAnchor.MiddleLeft).AddTo(myInspector);
UIUtility.GetLabel("Normal Setting", 14, color: UIUtility.AkiBlue, anchor: TextAnchor.MiddleLeft).AddTo(myInspector);
myInspector.Q<PropertyField>("PropertyField:logType").MoveToEnd(myInspector);
myInspector.Q<PropertyField>("PropertyField:tickType").MoveToEnd(myInspector);
var isActive = new Toggle("Is Active");
isActive.tooltip = SkilSearchTooltip;
isActive.BindProperty(serializedObject.FindProperty("isActive"));
isActive.AddTo(myInspector);
myInspector.AddSpace();
UIUtility.GetLabel("Pro Setting",14,color:UIUtility.AkiBlue,anchor:TextAnchor.MiddleLeft).AddTo(myInspector);
var skipSearchProperty=serializedObject.FindProperty("skipSearchWhenActionRunning");
var skipSearchToggle=new Toggle("Skip Search When Action Running");
skipSearchToggle.tooltip=SkilSearchTooltip;
UIUtility.GetLabel("Pro Setting", 14, color: UIUtility.AkiBlue, anchor: TextAnchor.MiddleLeft).AddTo(myInspector);
var skipSearchProperty = serializedObject.FindProperty("skipSearchWhenActionRunning");
var skipSearchToggle = new Toggle("Skip Search When Action Running");
skipSearchToggle.tooltip = SkilSearchTooltip;
skipSearchToggle.BindProperty(skipSearchProperty);
skipSearchToggle.AddTo(myInspector);
//SnapShot
UIUtility.GetButton(ButtonText,UIUtility.AkiRed,ShowPlannerWindow,100)
UIUtility.GetButton(ButtonText, UIUtility.AkiRed, ShowPlannerWindow, 100)
.Enabled(Application.isPlaying)
.AddTo(myInspector);
//Editor
UIUtility.GetButton(GraphButtonText,UIUtility.AkiBlue,ShowGOAPEditor,100)
UIUtility.GetButton(GraphButtonText, UIUtility.AkiBlue, ShowGOAPEditor, 100)
.Enabled(Application.isPlaying)
.AddTo(myInspector);
.AddTo(myInspector);
return myInspector;
}
private void ShowPlannerWindow()
Expand Down
12 changes: 6 additions & 6 deletions Editor/Resources/Icons/action_icon.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 6 additions & 6 deletions Editor/Resources/Icons/goal_icon.png.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

12 changes: 4 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

AkiGOAP是一个支持可视化、模块化编辑,支持多线程的Goal Oriented Action Planner(目标导向的行为规划)Unity插件,同时集成了多个开源GOAP插件的功能。

## 特点
AkiGOAP is a Goal Oriented Action Planner unity plugin that supports visualization, modular editing, and multi-threading, which integrates the functions of multiple open source GOAP plugins.
## 特点 Features

1. 多线程, 使用Unity Job System

Expand All @@ -22,12 +23,7 @@ AkiGOAP是一个支持可视化、模块化编辑,支持多线程的Goal Orien

<img src="Images/SnapShot.png" />

## 安装
1. 从Release下载Package [Release Package](https://github.com/AkiKurisu/AkiGOAP/releases)
2. 使用Unity Package Manager通过git URL下载 ```https://github.com/AkiKurisu/AkiGOAP.git```
#

## 如何使用
## 如何使用 How To Use

由于GOAP AI的设计需要一定门槛,我只介绍如何使用插件的核心功能,具体的设计可以参考插件提供的Example样例。

Expand Down Expand Up @@ -80,7 +76,7 @@ AkiGOAP是一个支持可视化、模块化编辑,支持多线程的Goal Orien
8. 点击GOAPPlannerGOAPPlannerPro的```Open GOAP Editor```打开编辑器查看当前所有GoalPriority优先级和所有ActionCost代价
9. 点击GOAPPlannerGOAPPlannerPro的```Open Planner Snapshot```打开快照查看当前的Plan计划(即抵达当前Goal的一串Action序列)

## 说明
## 说明 Explanation
1. GOAPPlanner没有使用JobSystem,仅使用对象池减少了GC开销,适用于复杂度较低的任务,优化自 https://github.com/toastisme/OpenGOAP
特点:根据优先级最高的Goal搜索路径,没有搜索到则FallBack至下一优先级的Goal
Expand Down
Loading

0 comments on commit df401d4

Please sign in to comment.