Using an event for the device interaction is better. If I get to where there's tons of devices then I'll rethink it but right now this is less convoluted.
This commit is contained in:
parent
8defc0bedf
commit
e63a8dd920
8 changed files with 46 additions and 45 deletions
|
@ -217,6 +217,10 @@ void System::pickup(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::En
|
|||
|
||||
void System::device(DinkyECS::World &world, DinkyECS::Entity actor, DinkyECS::Entity item) {
|
||||
auto& device = world.get<Device>(item);
|
||||
|
||||
for(int event : device.events) {
|
||||
world.send<Events::GUI>((Events::GUI)event, actor, device);
|
||||
}
|
||||
|
||||
println("entity {} INTERACTED WITH DEVICE {}", actor, item);
|
||||
device.hit(actor, world);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue