diff options
author | Clyne Sullivan <tullivan99@gmail.com> | 2017-03-07 18:17:51 -0500 |
---|---|---|
committer | Clyne Sullivan <tullivan99@gmail.com> | 2017-03-07 18:17:51 -0500 |
commit | 08708d80209d0b2cebc8f5f849a9b66e34202d6f (patch) | |
tree | dae3bcdfcb8d1a83642b59c0c15760e3d3565062 /include/attack.hpp | |
parent | bd80053588a9a38c9f7a1f132d36fb0844b91af4 (diff) |
attacks?
Diffstat (limited to 'include/attack.hpp')
-rw-r--r-- | include/attack.hpp | 39 |
1 files changed, 39 insertions, 0 deletions
diff --git a/include/attack.hpp b/include/attack.hpp new file mode 100644 index 0000000..412694e --- /dev/null +++ b/include/attack.hpp @@ -0,0 +1,39 @@ +#ifndef FIGHT_HPP_ +#define FIGHT_HPP_ + +#include <entityx/entityx.h> + +#include <forward_list> + +#include <vector2.hpp> + +enum class AttackType : char { + ShortSlash, + LongSlash +}; + +struct AttackEvent { + AttackEvent(vec2 p, AttackType at, int pow = 10) + : pos(p), type(at), power(pow) {} + + vec2 pos; + AttackType type; + int power; +}; + +class AttackSystem : public entityx::System<AttackSystem>, public entityx::Receiver<AttackSystem> { +private: + std::forward_list<AttackEvent> attacks; + +public: + explicit AttackSystem() = default; + + void configure(entityx::EventManager& ev) { + ev.subscribe<AttackEvent>(*this); + } + + void receive(const AttackEvent& ae); + void update(entityx::EntityManager& en, entityx::EventManager& ev, entityx::TimeDelta dt) override; +}; + +#endif // FIGHT_HPP_ |