Merge remote-tracking branch 'origin/PlayerMovement' into Networking

This commit is contained in:
stiffly
2016-01-22 16:19:35 +01:00
25 changed files with 540 additions and 181 deletions
+13 -5
View File
@@ -1,14 +1,22 @@
#include "Common.h"
#include "GLM.h"
#include "Core/System.h"
#include "Events/EPlayerSpawned.h"
#include "Input/FirstPersonInputController.h"
class PlayerMovementSystem : public PureSystem
class PlayerMovementSystem : public ImpureSystem, PureSystem
{
public:
PlayerMovementSystem(World* world, EventBroker* eventBroker)
: System(world, eventBroker)
, PureSystem("Player")
{ }
PlayerMovementSystem(World* world, EventBroker* eventBroker);
~PlayerMovementSystem();
virtual void Update(double dt) override;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt);
private:
// State
std::unordered_map<EntityWrapper, FirstPersonInputController<PlayerMovementSystem>*> m_PlayerInputControllers;
EventRelay<PlayerMovementSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
};
+9 -1
View File
@@ -2,6 +2,8 @@
#include "Input/EInputCommand.h"
#include "Systems/SpawnerSystem.h"
#include "Events/ESpawnerSpawn.h"
#include "Events/EPlayerSpawned.h"
#include "Rendering/ESetCamera.h"
class PlayerSpawnSystem : public ImpureSystem
{
@@ -11,8 +13,14 @@ public:
virtual void Update(double dt) override;
private:
struct SpawnRequest
{
int PlayerID;
ComponentInfo::EnumType Team;
};
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
bool OnInputCommand(const Events::InputCommand& e);
std::vector<int> m_SpawnRequests;
std::vector<SpawnRequest> m_SpawnRequests;
};