From 6eb915c129fc90c6f4c82ae097dd6ffad5239efc Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Jan 2021 14:28:30 +0800 Subject: +scripts --- .../XMainClient/AI/AIRunTimeRandomSelectorNode.cs | 35 ++++++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomSelectorNode.cs (limited to 'Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomSelectorNode.cs') diff --git a/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomSelectorNode.cs b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomSelectorNode.cs new file mode 100644 index 00000000..d0dd80d5 --- /dev/null +++ b/Client/Assets/Scripts/XMainClient/AI/AIRunTimeRandomSelectorNode.cs @@ -0,0 +1,35 @@ +using System; +using System.Xml; + +namespace XMainClient +{ + internal class AIRunTimeRandomSelectorNode : AIRunTimeLogicNode + { + protected AIRunTimeRandomIndex _random_index = null; + + public AIRunTimeRandomSelectorNode(XmlElement node) : base(node) + { + this._random_index = new AIRunTimeRandomIndex(); + } + + public override void AddChild(AIRunTimeNodeBase child) + { + base.AddChild(child); + this._random_index.AppendIndex(); + } + + public override bool Update(XEntity entity) + { + this._random_index.Rand(); + for (int i = 0; i < this._list_node.Count; i++) + { + bool flag = this._list_node[this._random_index[i]].Update(entity); + if (flag) + { + return true; + } + } + return false; + } + } +} -- cgit v1.1-26-g67d0