Tank tower and barrel steering working

This commit is contained in:
ViktorLjung
2014-05-12 22:33:53 +02:00
parent 92e9fd1049
commit 38482431a1
17 changed files with 246 additions and 96 deletions
+42 -3
View File
@@ -4,6 +4,8 @@
#include "Events/TankSteer.h"
#include "Components/Transform.h"
#include "Components/TankSteering.h"
#include "Components/TowerSteering.h"
#include "Components/BarrelSteering.h"
#include "Components/Vehicle.h"
#include "InputController.h"
@@ -24,22 +26,59 @@ namespace Systems
private:
class TankSteeringInputController;
std::unique_ptr<TankSteeringInputController> m_InputController;
std::unique_ptr<TankSteeringInputController> m_TankInputController;
class TowerSteeringInputController;
std::unique_ptr<TowerSteeringInputController> m_TowerInputController;
};
class TankSteeringSystem::TankSteeringInputController : InputController
{
public:
TankSteeringInputController(std::shared_ptr<::EventBroker> eventBroker)
: InputController(eventBroker) { }
: InputController(eventBroker)
{
m_Horizontal = 0.f;
m_Vertical = 0.f;
PositionX = 0;
PositionY = 0;
Handbrake = false;
}
float PositionY;
float PositionX;
bool Handbrake;
void Update(double dt);
protected:
virtual bool OnCommand(const Events::InputCommand &event);
virtual bool OnMouseMove(const Events::MouseMove &event);
private:
float m_Horizontal;
float m_Vertical;
};
class TankSteeringSystem::TowerSteeringInputController : InputController
{
public:
TowerSteeringInputController(std::shared_ptr<::EventBroker> eventBroker)
: InputController(eventBroker)
{
m_TowerDirection = 0.f;
m_BarrelDirection = 0.f;
TowerDirection = 0.f;
BarrelDirection = 0.f;
}
float TowerDirection;
float BarrelDirection;
void Update(double dt);
protected:
virtual bool OnCommand(const Events::InputCommand &event);
virtual bool OnMouseMove(const Events::MouseMove &event);
private:
float m_TowerDirection;
float m_BarrelDirection;
};
}