From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../Scripts/XMainClient/AI/AIRunTimeValueTarget.cs | 39 ++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs') diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs new file mode 100644 index 00000000..857d8635 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs @@ -0,0 +1,39 @@ +using System; +using System.Xml; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class AIRunTimeValueTarget : AIRunTimeNodeCondition + { + private string _shared_target_name; + + public AIRunTimeValueTarget(XmlElement node) : base(node) + { + this._shared_target_name = node.GetAttribute("Shared_TargetName"); + } + + public override bool Update(XEntity entity) + { + XGameObject xgameObjectByName = entity.AI.AIData.GetXGameObjectByName(this._shared_target_name); + XEntity xentity = null; + bool flag = xgameObjectByName != null; + if (flag) + { + xentity = XSingleton.singleton.GetEntity(xgameObjectByName.UID); + } + bool flag2 = xgameObjectByName != null && xentity != null && XEntity.ValideEntity(xentity); + bool result; + if (flag2) + { + result = true; + } + else + { + entity.AI.SetTarget(null); + result = false; + } + return result; + } + } +} -- cgit v1.1-26-g67d0