#ifndef PlayerSystem_h__ #define PlayerSystem_h__ #include #include #include "Common.h" #include "Core/System.h" #include "Core/EventBroker.h" #include "Core/EKeyDown.h" #include "Core/EKeyUp.h" struct KeyInput { bool Forward = false; bool Left = false; bool Back = false; bool Right = false; }; class PlayerSystem : public System { public: PlayerSystem(EventBroker* eventBroker) : System(eventBroker, "Player") { EVENT_SUBSCRIBE_MEMBER(m_EKeyDown, &PlayerSystem::OnKeyDown); EVENT_SUBSCRIBE_MEMBER(m_EKeyUp, &PlayerSystem::OnKeyUp); } virtual void Update(World* world, ComponentWrapper& player, double dt) override; private: float m_Speed = 5; glm::vec3 m_Direction; KeyInput input; EventRelay m_EKeyDown; bool OnKeyDown(const Events::KeyDown &event); EventRelay m_EKeyUp; bool OnKeyUp(const Events::KeyUp &event); }; #endif