FreeSteeringSystem converted to take input commands

This commit is contained in:
2014-05-06 17:07:38 +02:00
parent 8c8edd0e8e
commit a232559bb1
5 changed files with 155 additions and 64 deletions
+27 -1
View File
@@ -2,11 +2,12 @@
#include "System.h"
#include "Components/Transform.h"
#include "Components/Input.h"
#include "Components/FreeSteering.h"
#include "InputController.h"
namespace Systems
{
class FreeSteeringSystem : public System
{
public:
@@ -14,8 +15,33 @@ public:
: System(world, eventBroker) { }
void RegisterComponents(ComponentFactory* cf) override;
void Initialize() override;
void Update(double dt) override;
void UpdateEntity(double dt, EntityID entity, EntityID parent) override;
private:
class FreeSteeringInputController;
std::unique_ptr<FreeSteeringInputController> m_InputController;
};
class FreeSteeringSystem::FreeSteeringInputController : InputController
{
public:
FreeSteeringInputController(std::shared_ptr<::EventBroker> eventBroker)
: InputController(eventBroker)
, SpeedMultiplier(1.f)
, OrientationActive(false) { }
glm::vec3 Movement;
glm::quat Orientation;
float SpeedMultiplier;
bool OrientationActive;
protected:
virtual bool OnCommand(const Events::InputCommand &event);
virtual bool OnMouseMove(const Events::MouseMove &event);
};
}