From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/AI/AIRunTimeFindTargetByDist.cs | 53 ++++++++++++++++++++++ 1 file changed, 53 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AI/AIRunTimeFindTargetByDist.cs (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeFindTargetByDist.cs') diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeFindTargetByDist.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeFindTargetByDist.cs new file mode 100644 index 00000000..ad5a6af4 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeFindTargetByDist.cs @@ -0,0 +1,53 @@ +using System; +using System.Xml; +using XUtliPoolLib; + +namespace XMainClient +{ + internal class AIRunTimeFindTargetByDist : AIRunTimeNodeAction + { + private string _distance_name; + + private float _distance; + + private bool _filter_immortal; + + private float _angle; + + private float _delta; + + private int _targettype; + + public AIRunTimeFindTargetByDist(XmlElement node) : base(node) + { + this._distance_name = node.GetAttribute("Shared_DistanceName"); + this._distance = float.Parse(node.GetAttribute("Shared_DistancemValue")); + string attribute = node.GetAttribute("FilterImmortal"); + string attribute2 = node.GetAttribute("TargetType"); + string attribute3 = node.GetAttribute("Angle"); + bool flag = !float.TryParse(attribute3, out this._angle); + if (flag) + { + this._angle = 180f; + } + string attribute4 = node.GetAttribute("Delta"); + bool flag2 = !float.TryParse(attribute4, out this._delta); + if (flag2) + { + this._delta = 0f; + } + bool.TryParse(attribute, out this._filter_immortal); + bool flag3 = !int.TryParse(attribute2, out this._targettype); + if (flag3) + { + this._targettype = 0; + } + } + + public override bool Update(XEntity entity) + { + float floatByName = entity.AI.AIData.GetFloatByName(this._distance_name, this._distance); + return XSingleton.singleton.FindTargetByDistance(entity, floatByName, this._filter_immortal, this._angle, this._delta, this._targettype); + } + } +} -- cgit v1.1-26-g67d0