1
This commit is contained in:
parent
4d8ea40d07
commit
2abae9c0f3
@ -494,5 +494,24 @@ void Obstacle::SetRotate(float rotate)
|
||||
|
||||
void Obstacle::DoTreasureBoxInteraction(Human* sender)
|
||||
{
|
||||
|
||||
if (!IsDead(sender->room)) {
|
||||
Die(sender->room);
|
||||
BroadcastFullState(sender->room);
|
||||
sender->room->xtimer.SetTimeoutEx
|
||||
(meta->delay_destroy() / FRAME_RATE_MS,
|
||||
[sender, obj_uniid = GetUniId()] (int event, const a8::Args* args)
|
||||
{
|
||||
if (a8::TIMER_EXEC_EVENT == event) {
|
||||
Entity* entity = sender->room->GetEntityByUniId(obj_uniid);
|
||||
if (entity && entity->IsEntityType(ET_Obstacle)) {
|
||||
Obstacle* ob = (Obstacle*)entity;
|
||||
if (ob->IsRoomObstacle()) {
|
||||
sender->room->RemoveObjectLater((RoomObstacle*)entity);
|
||||
}
|
||||
}
|
||||
return;
|
||||
}
|
||||
},
|
||||
&sender->xtimer_attacher);
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user