summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRunTimeValueTarget.cs
blob: 857d8635fba5f555037299bd7a40f4e73ee49a26 (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
using System;
using System.Xml;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRunTimeValueTarget : AIRunTimeNodeCondition
	{
		private string _shared_target_name;

		public AIRunTimeValueTarget(XmlElement node) : base(node)
		{
			this._shared_target_name = node.GetAttribute("Shared_TargetName");
		}

		public override bool Update(XEntity entity)
		{
			XGameObject xgameObjectByName = entity.AI.AIData.GetXGameObjectByName(this._shared_target_name);
			XEntity xentity = null;
			bool flag = xgameObjectByName != null;
			if (flag)
			{
				xentity = XSingleton<XEntityMgr>.singleton.GetEntity(xgameObjectByName.UID);
			}
			bool flag2 = xgameObjectByName != null && xentity != null && XEntity.ValideEntity(xentity);
			bool result;
			if (flag2)
			{
				result = true;
			}
			else
			{
				entity.AI.SetTarget(null);
				result = false;
			}
			return result;
		}
	}
}