Started refactoring. Put player walk logic in a designated sound system.

This commit is contained in:
stiffly
2016-02-05 16:39:23 +01:00
parent 3e2afd7bf2
commit fbdaf92953
7 changed files with 281 additions and 216 deletions
+3 -2
View File
@@ -30,7 +30,8 @@
#include "Network/Client.h"
// Sound
#include "Sound/SoundSystem.h"
//#include "Sound/SoundManager.h"
#include "Systems/SoundSystem.h"
class Game
{
@@ -64,7 +65,7 @@ private:
bool m_IsClientOrServer = false;
// Sound
SoundSystem* m_SoundSystem;
SoundManager* m_SoundManager;
//EventRelay<Game, Events::InputCommand> m_EInputCommand;
//bool debugOnInputCommand(const Events::InputCommand& e);
+31
View File
@@ -0,0 +1,31 @@
#ifndef Systems_SoundSystem_h__
#define Systems_SoundSystem_h__
#include "../Engine/Core/System.h"
#include "../Engine/Sound/SoundManager.h"
#include "../Engine/Core/EPlayerSpawned.h"
class SoundSystem : public PureSystem, ImpureSystem, SoundManager
{
public:
SoundSystem(World* world, EventBroker* eventbroker);
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) override;
virtual void Update(double dt) override;
private:
void playerStep(double dt);
EntityWrapper m_LocalPlayer = EntityWrapper();
World* m_World = nullptr;
EventBroker* m_EventBroker = nullptr;
// TODO: WIP Update this
double m_TimeSinceLastFootstep = 0.0;
const double m_PlayerFootstepInterval = 1.0;
bool m_LeftFoot = false;
EventRelay<SoundSystem, Events::PlayerSpawned> m_EPlayerSpawned;
bool OnPlayerSpawned(const Events::PlayerSpawned &e);
};
#endif