MULTIPLAYER

This commit is contained in:
ViktorLjung
2014-05-20 00:20:09 +02:00
parent ff58f881ae
commit 609687d6b4
15 changed files with 575 additions and 117 deletions
+20 -29
View File
@@ -11,6 +11,7 @@
#include "Components/BarrelSteering.h"
#include "Components/Physics.h"
#include "Components/Vehicle.h"
#include "Components/Player.h"
#include "Systems/TransformSystem.h"
#include "InputController.h"
@@ -31,9 +32,7 @@ namespace Systems
private:
class TankSteeringInputController;
std::unique_ptr<TankSteeringInputController> m_TankInputController;
class TowerSteeringInputController;
std::unique_ptr<TowerSteeringInputController> m_TowerInputController;
std::array<std::shared_ptr<TankSteeringInputController>, 4> m_TankInputControllers;
std::map<EntityID, double> m_TimeSinceLastShot;
};
@@ -41,35 +40,17 @@ namespace Systems
class TankSteeringSystem::TankSteeringInputController : InputController
{
public:
TankSteeringInputController(std::shared_ptr<::EventBroker> eventBroker)
TankSteeringInputController(std::shared_ptr<::EventBroker> eventBroker, int playerID)
: InputController(eventBroker)
{
PlayerID = playerID;
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;
@@ -78,18 +59,28 @@ namespace Systems
m_Shoot = false;
}
int PlayerID;
float PositionY;
float PositionX;
bool Handbrake;
float TowerDirection;
float BarrelDirection;
bool Shoot;
void Update(double dt);
protected:
virtual bool OnCommand(const Events::InputCommand &event);
virtual bool OnMouseMove(const Events::MouseMove &event);
//virtual bool OnMouseMove(const Events::MouseMove &event);
private:
float m_TowerDirection;
float m_BarrelDirection;
bool m_Shoot;
};
float m_Horizontal;
float m_Vertical;
float m_TowerDirection;
float m_BarrelDirection;
bool m_Shoot;
};
}