summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRunTimeConditionalEvaluator.cs
blob: 2a657e57e800d01428abbb04e1203af39d773176 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
using System;
using System.Xml;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRunTimeConditionalEvaluator : AIRunTimeDecorationNode
	{
		public string ConditionNodeName
		{
			get
			{
				return this._condition_node_name;
			}
		}

		private string _condition_node_name;

		private AIRunTimeNodeBase _condition_node;

		public AIRunTimeConditionalEvaluator(XmlElement node) : base(node)
		{
			this._condition_node_name = node.GetAttribute("ConditionalTask");
		}

		public bool AddConditionNode(AIRunTimeNodeBase node)
		{
			bool flag = this._condition_node != null;
			bool result;
			if (flag)
			{
				XSingleton<XDebug>.singleton.AddErrorLog("ConditionNode already contain condition node", null, null, null, null, null);
				result = false;
			}
			else
			{
				this._condition_node = node;
				result = true;
			}
			return result;
		}

		public override bool Update(XEntity entity)
		{
			bool flag = this._condition_node != null;
			bool result;
			if (flag)
			{
				bool flag2 = !this._condition_node.Update(entity);
				if (flag2)
				{
					result = false;
				}
				else
				{
					bool flag3 = this._child_node != null;
					result = (flag3 && this._child_node.Update(entity));
				}
			}
			else
			{
				result = false;
			}
			return result;
		}
	}
}