summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-01-25 14:28:30 +0800
committerchai <chaifix@163.com>2021-01-25 14:28:30 +0800
commit6eb915c129fc90c6f4c82ae097dd6ffad5239efc (patch)
tree7dd2be50edf41f36b60fac84696e731c13afe617 /Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs')
-rw-r--r--Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs42
1 files changed, 42 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs b/Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs
new file mode 100644
index 00000000..5912ec67
--- /dev/null
+++ b/Client/Assets/Scripts/XMainClient/AI/AIRuntimeActionMove.cs
@@ -0,0 +1,42 @@
+using System;
+using System.Xml;
+using UnityEngine;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class AIRuntimeActionMove : AIRunTimeNodeAction
+ {
+ private string _move_dir;
+
+ private string _move_dest;
+
+ private string _move_speed;
+
+ public AIRuntimeActionMove(XmlElement node) : base(node)
+ {
+ this._move_dir = node.GetAttribute("Shared_MoveDirName");
+ this._move_dest = node.GetAttribute("Shared_MoveDestName");
+ this._move_speed = node.GetAttribute("Shared_MoveSpeedName");
+ }
+
+ public override bool Update(XEntity entity)
+ {
+ Vector3 vector = entity.AI.AIData.GetVector3ByName(this._move_dir, Vector3.zero);
+ Vector3 vector2 = entity.AI.AIData.GetVector3ByName(this._move_dest, Vector3.zero);
+ bool flag = vector == Vector3.zero;
+ if (flag)
+ {
+ vector = (vector2 - entity.EngineObject.Position).normalized;
+ vector.Set(vector.x, 0f, vector.z);
+ }
+ bool flag2 = vector2 == Vector3.zero;
+ if (flag2)
+ {
+ vector2 = entity.EngineObject.Position + vector.normalized * 50f;
+ }
+ float floatByName = entity.AI.AIData.GetFloatByName(this._move_speed, 0f);
+ return XSingleton<XAIMove>.singleton.ActionMove(entity, vector, vector2, floatByName);
+ }
+ }
+}