summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRunTimeFloatComparison.cs
blob: 1e7bcc3b60614650b6f41f9ae9f70cfbccf667b9 (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
68
69
70
71
72
73
74
75
76
77
78
using System;
using System.Xml;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRunTimeFloatComparison : AIRunTimeNodeAction
	{
		private int _comp_type;

		private string _float_name1;

		private float _float_value1;

		private string _float_name2;

		private float _float_value2;

		public AIRunTimeFloatComparison(XmlElement node) : base(node)
		{
			this._float_name1 = node.GetAttribute("Shared_Float1Name");
			this._float_value1 = float.Parse(node.GetAttribute("float1Value"));
			this._float_name2 = node.GetAttribute("Shared_Float2Name");
			this._float_value2 = float.Parse(node.GetAttribute("float2Value"));
			this._comp_type = int.Parse(node.GetAttribute("type"));
		}

		public override bool Update(XEntity entity)
		{
			float floatByName = entity.AI.AIData.GetFloatByName(this._float_name1, this._float_value1);
			float floatByName2 = entity.AI.AIData.GetFloatByName(this._float_name2, this._float_value2);
			bool flag = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_LESS_THAN);
			bool result;
			if (flag)
			{
				result = (floatByName < floatByName2);
			}
			else
			{
				bool flag2 = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_LESS_OR_EQUAL_TO);
				if (flag2)
				{
					result = (floatByName <= floatByName2);
				}
				else
				{
					bool flag3 = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_EQUAL_TO);
					if (flag3)
					{
						result = (floatByName == floatByName2);
					}
					else
					{
						bool flag4 = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_NOT_EQUAL_TO);
						if (flag4)
						{
							result = (floatByName != floatByName2);
						}
						else
						{
							bool flag5 = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_GREATER_THAN);
							if (flag5)
							{
								result = (floatByName > floatByName2);
							}
							else
							{
								bool flag6 = this._comp_type == XFastEnumIntEqualityComparer<ComparisonType>.ToInt(ComparisonType.FCTYPE_GREATER_THAN_OR_EQUAL_TO);
								result = (flag6 && floatByName >= floatByName2);
							}
						}
					}
				}
			}
			return result;
		}
	}
}