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
10
devices.hpp
10
devices.hpp
|
@ -6,14 +6,10 @@
|
|||
namespace components {
|
||||
using namespace nlohmann;
|
||||
|
||||
typedef std::function<void(DinkyECS::Entity ent, json &config, DinkyECS::World &world)> Action;
|
||||
|
||||
void StairsDown(DinkyECS::Entity player_ent, json &data, DinkyECS::World &world);
|
||||
void StairsUp(DinkyECS::Entity player_ent, json &data, DinkyECS::World &world);
|
||||
|
||||
struct Device {
|
||||
json config;
|
||||
std::vector<Action> actions;
|
||||
void hit(DinkyECS::Entity ent, DinkyECS::World &world);
|
||||
std::vector<int> events;
|
||||
|
||||
void configure_events(json &event_names);
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue