diff options
author | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
---|---|---|
committer | chai <chaifix@163.com> | 2021-01-25 14:28:30 +0800 |
commit | 6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch) | |
tree | 7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs new file mode 100644 index 00000000..56b54daa --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs @@ -0,0 +1,151 @@ +using System;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class AIRunTimeBehaviorTree : IXBehaviorTree, IXInterface
+ {
+ public XEntity Host
+ {
+ get
+ {
+ return this._host;
+ }
+ set
+ {
+ this._host = value;
+ }
+ }
+
+ public AIRunTimeRootNode Root
+ {
+ get
+ {
+ return this._root;
+ }
+ set
+ {
+ this._root = value;
+ }
+ }
+
+ public SharedData Data
+ {
+ get
+ {
+ return this._data;
+ }
+ }
+
+ public bool Deprecated { get; set; }
+
+ private AIRunTimeRootNode _root = null;
+
+ private SharedData _data = null;
+
+ private string _tree_name;
+
+ private XEntity _host = null;
+
+ private bool _enable = false;
+
+ public bool SetBehaviorTree(string name)
+ {
+ bool flag = string.IsNullOrEmpty(name);
+ bool result;
+ if (flag)
+ {
+ result = false;
+ }
+ else
+ {
+ this._tree_name = name;
+ this._root = XSingleton<AIRunTimeTreeMgr>.singleton.GetBehavior(name);
+ this._data = this.DeepClone(this._root.Data);
+ this._data.SetBoolByName("IsFighting", true);
+ this._data.SetBoolByName("HitStatus", true);
+ result = true;
+ }
+ return result;
+ }
+
+ public SharedData DeepClone(SharedData source)
+ {
+ return new SharedData(source);
+ }
+
+ public void OnStartSkill(uint skillid)
+ {
+ }
+
+ public void OnEndSkill(uint skillid)
+ {
+ }
+
+ public void OnSkillHurt()
+ {
+ }
+
+ public void EnableBehaviorTree(bool enable)
+ {
+ this._enable = enable;
+ }
+
+ public void SetManual(bool enable)
+ {
+ }
+
+ public float OnGetHeartRate()
+ {
+ return this._data.GetFloatByName("heartrate", 0f);
+ }
+
+ public void TickBehaviorTree()
+ {
+ bool enable = this._enable;
+ if (enable)
+ {
+ this._root.Update(this._host);
+ }
+ }
+
+ public void SetNavPoint(Transform navpoint)
+ {
+ }
+
+ public void SetIntByName(string name, int value)
+ {
+ this._data.SetIntByName(name, value);
+ }
+
+ public void SetFloatByName(string name, float value)
+ {
+ this._data.SetFloatByName(name, value);
+ }
+
+ public void SetBoolByName(string name, bool value)
+ {
+ this._data.SetBoolByName(name, value);
+ }
+
+ public void SetVector3ByName(string name, Vector3 value)
+ {
+ this._data.SetVector3ByName(name, value);
+ }
+
+ public void SetTransformByName(string name, Transform value)
+ {
+ this._data.SetTransformByName(name, value);
+ }
+
+ public void SetXGameObjectByName(string name, XGameObject value)
+ {
+ this._data.SetXGameObjectByName(name, value);
+ }
+
+ public void SetVariable(string name, object value)
+ {
+ }
+ }
+}
|