summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XMainClient/AI/AIRunTimeBehaviorTree.cs
blob: 56b54daa5943e939e8b1d02f7e0d443432d530f9 (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
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
using System;
using UnityEngine;
using XUtliPoolLib;

namespace XMainClient
{
	internal class AIRunTimeBehaviorTree : IXBehaviorTree, IXInterface
	{
		public XEntity Host
		{
			get
			{
				return this._host;
			}
			set
			{
				this._host = value;
			}
		}

		public AIRunTimeRootNode Root
		{
			get
			{
				return this._root;
			}
			set
			{
				this._root = value;
			}
		}

		public SharedData Data
		{
			get
			{
				return this._data;
			}
		}

		public bool Deprecated { get; set; }

		private AIRunTimeRootNode _root = null;

		private SharedData _data = null;

		private string _tree_name;

		private XEntity _host = null;

		private bool _enable = false;

		public bool SetBehaviorTree(string name)
		{
			bool flag = string.IsNullOrEmpty(name);
			bool result;
			if (flag)
			{
				result = false;
			}
			else
			{
				this._tree_name = name;
				this._root = XSingleton<AIRunTimeTreeMgr>.singleton.GetBehavior(name);
				this._data = this.DeepClone(this._root.Data);
				this._data.SetBoolByName("IsFighting", true);
				this._data.SetBoolByName("HitStatus", true);
				result = true;
			}
			return result;
		}

		public SharedData DeepClone(SharedData source)
		{
			return new SharedData(source);
		}

		public void OnStartSkill(uint skillid)
		{
		}

		public void OnEndSkill(uint skillid)
		{
		}

		public void OnSkillHurt()
		{
		}

		public void EnableBehaviorTree(bool enable)
		{
			this._enable = enable;
		}

		public void SetManual(bool enable)
		{
		}

		public float OnGetHeartRate()
		{
			return this._data.GetFloatByName("heartrate", 0f);
		}

		public void TickBehaviorTree()
		{
			bool enable = this._enable;
			if (enable)
			{
				this._root.Update(this._host);
			}
		}

		public void SetNavPoint(Transform navpoint)
		{
		}

		public void SetIntByName(string name, int value)
		{
			this._data.SetIntByName(name, value);
		}

		public void SetFloatByName(string name, float value)
		{
			this._data.SetFloatByName(name, value);
		}

		public void SetBoolByName(string name, bool value)
		{
			this._data.SetBoolByName(name, value);
		}

		public void SetVector3ByName(string name, Vector3 value)
		{
			this._data.SetVector3ByName(name, value);
		}

		public void SetTransformByName(string name, Transform value)
		{
			this._data.SetTransformByName(name, value);
		}

		public void SetXGameObjectByName(string name, XGameObject value)
		{
			this._data.SetXGameObjectByName(name, value);
		}

		public void SetVariable(string name, object value)
		{
		}
	}
}