blob: db89ee1d6d8707c77f229f2e26af6159c97e7267 (
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
|
using System;
using XUtliPoolLib;
namespace XMainClient
{
internal sealed class XAIGlobal
{
public XEntity Host
{
get
{
return this._host;
}
}
private XEntity _host = null;
public void InitAIGlobal(string ainame)
{
this._host = XSingleton<XEntityMgr>.singleton.CreateEmpty();
this._host.AI = (XSingleton<XComponentMgr>.singleton.CreateComponent(this._host, XAIComponent.uuID) as XAIComponent);
this._host.AI.SetBehaviorTree(ainame);
}
public void UnInitAIGlobal()
{
bool flag = this._host != null;
if (flag)
{
XSingleton<XEntityMgr>.singleton.DestroyEntity(this._host);
}
this._host = null;
}
public void SendAIMsg(string msg, float time = 0f, int typeid = 0, int argid = 0)
{
bool flag = this._host == null || this._host.AI == null;
if (!flag)
{
XAIEventArgs @event = XEventPool<XAIEventArgs>.GetEvent();
@event.DepracatedPass = false;
@event.Firer = this._host;
@event.EventType = 1;
@event.EventArg = msg;
@event.SkillId = argid;
@event.TypeId = typeid;
uint item = XSingleton<XEventMgr>.singleton.FireEvent(@event, (time > 0f) ? time : 0.05f);
this._host.AI.TimerToken.Add(item);
}
}
public void ClearAllTimer()
{
bool flag = this._host != null && this._host.AI != null;
if (flag)
{
this._host.AI.ClearAllTimer();
}
}
}
}
|