Created EPlayerSpawned that gets published when a player spawns

This commit is contained in:
2016-01-22 10:16:35 +01:00
parent 8cf83454d7
commit 1e3fc1ae2d
3 changed files with 41 additions and 5 deletions
+19
View File
@@ -0,0 +1,19 @@
#ifndef EPlayerSpawned_h__
#define EPlayerSpawned_h__
#include "Core/Event.h"
#include "Core/EntityWrapper.h"
namespace Events
{
struct PlayerSpawned : Event
{
int PlayerID;
EntityWrapper Player;
EntityWrapper Spawner;
};
}
#endif
+8 -1
View File
@@ -2,6 +2,7 @@
#include "Input/EInputCommand.h"
#include "Systems/SpawnerSystem.h"
#include "Events/ESpawnerSpawn.h"
#include "Events/EPlayerSpawned.h"
class PlayerSpawnSystem : public ImpureSystem
{
@@ -11,8 +12,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;
};