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/AIRunTimeRandomFloat.cs |
+scripts
Diffstat (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomFloat.cs')
-rw-r--r-- | Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomFloat.cs | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomFloat.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomFloat.cs new file mode 100644 index 00000000..e65d035e --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomFloat.cs @@ -0,0 +1,37 @@ +using System;
+using System.Xml;
+using XUtliPoolLib;
+
+namespace XMainClient
+{
+ internal class AIRunTimeRandomFloat : AIRunTimeNodeAction
+ {
+ private float _min_value;
+
+ private string _min_name;
+
+ private float _max_value;
+
+ private string _max_name;
+
+ private string _store_result_name;
+
+ public AIRunTimeRandomFloat(XmlElement node) : base(node)
+ {
+ this._min_value = float.Parse(node.GetAttribute("minValue"));
+ this._min_name = node.GetAttribute("Shared_MinName");
+ this._max_value = float.Parse(node.GetAttribute("maxValue"));
+ this._max_name = node.GetAttribute("Shared_MaxName");
+ this._store_result_name = node.GetAttribute("Shared_StoredResultName");
+ }
+
+ public override bool Update(XEntity entity)
+ {
+ float floatByName = entity.AI.AIData.GetFloatByName(this._min_name, this._min_value);
+ float floatByName2 = entity.AI.AIData.GetFloatByName(this._max_name, this._max_value);
+ float para = XSingleton<XCommon>.singleton.RandomFloat(floatByName, floatByName2);
+ entity.AI.AIData.SetFloatByName(this._store_result_name, para);
+ return true;
+ }
+ }
+}
|