Skip to content

Commit 12fad2b

Browse files
committed
up
1 parent 470885b commit 12fad2b

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

KBEngine.cs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1749,6 +1749,7 @@ public void Client_onEntityLeaveWorld(Int32 eid)
17491749
else
17501750
{
17511751
_controlledEntities.Remove(entity);
1752+
Event.fireOut("onLoseControlledEntity", new object[]{entity});
17521753
entities.Remove(eid);
17531754
entity.onDestroy();
17541755
_entityIDAliasIDList.Remove(eid);
@@ -1836,7 +1837,9 @@ public void Client_onControlEntity(Int32 eid, sbyte isControlled)
18361837
// 如果被控制者是玩家自己,那表示玩家自己被其它人控制了
18371838
// 所以玩家自己不应该进入这个被控制列表
18381839
if (player().id != entity.id)
1840+
{
18391841
_controlledEntities.Add(entity);
1842+
}
18401843
}
18411844
else
18421845
{
@@ -1848,6 +1851,7 @@ public void Client_onControlEntity(Int32 eid, sbyte isControlled)
18481851
try
18491852
{
18501853
entity.onControlled(isCont);
1854+
Event.fireOut("onControlled", new object[]{entity, isCont});
18511855
}
18521856
catch (Exception e)
18531857
{
@@ -2071,6 +2075,8 @@ public void Client_onEntityDestroyed(Int32 eid)
20712075
}
20722076

20732077
_controlledEntities.Remove(entity);
2078+
Event.fireOut("onLoseControlledEntity", new object[]{entity});
2079+
20742080
entities.Remove(eid);
20752081
entity.onDestroy();
20762082
}
@@ -2088,6 +2094,7 @@ public void Client_onUpdateBasePos(float x, float y, float z)
20882094
if (entity != null && entity.isControlled)
20892095
{
20902096
entity.position.Set(_entityServerPos.x, _entityServerPos.y, _entityServerPos.z);
2097+
Event.fireOut("updatePosition", new object[]{entity});
20912098
entity.onUpdateVolatileData();
20922099
}
20932100
}
@@ -2102,6 +2109,7 @@ public void Client_onUpdateBasePosXZ(float x, float z)
21022109
{
21032110
entity.position.x = _entityServerPos.x;
21042111
entity.position.z = _entityServerPos.z;
2112+
Event.fireOut("updatePosition", new object[]{entity});
21052113
entity.onUpdateVolatileData();
21062114
}
21072115
}
@@ -2117,6 +2125,7 @@ public void Client_onUpdateBaseDir(MemoryStream stream)
21172125
if (entity != null && entity.isControlled)
21182126
{
21192127
entity.direction.Set(roll, pitch, yaw);
2128+
Event.fireOut("set_direction", new object[]{entity});
21202129
entity.onUpdateVolatileData();
21212130
}
21222131
}

README.md

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -92,6 +92,21 @@ KBE-Plugin fire-out events(KBE => Unity):
9292
bytes: datas
9393
If you use third-party account system, the system may fill some of the third-party additional datas.
9494

95+
onControlled
96+
Description:
97+
Triggered when the entity is controlled or out of control.
98+
99+
Event-datas:
100+
Enity
101+
bool: isControlled
102+
103+
onLoseControlledEntity
104+
Description:
105+
Lose controlled entity.
106+
107+
Event-datas:
108+
Enity
109+
95110
set_position
96111
Description:
97112
Sets the current position of the entity.

0 commit comments

Comments
 (0)