Files
axyz/include/Game/Systems/PlayerSpawnSystem.h
T
William Moberg 534d6639e5 Class enum instead of hardcoded ints.
Removed superfluous .Valid() checks.

Check for spectator spawnrequest in case they somehow has a class, so we don't get "x players were supposed to be spawned but failed" if it happens.
2016-03-09 11:35:32 +01:00

50 lines
1.4 KiB
C++

#include "Core/System.h"
#include "Input/EInputCommand.h"
#include "Systems/SpawnerSystem.h"
#include "Events/ESpawnerSpawn.h"
#include "Core/EPlayerSpawned.h"
#include "Core/EPlayerDeath.h"
#include "Rendering/ESetCamera.h"
#include "Core/ConfigFile.h"
class PlayerSpawnSystem : public ImpureSystem
{
public:
PlayerSpawnSystem(SystemParams params);
virtual void Update(double dt) override;
private:
// This enum must correspond to the command values for PickTeam buttons.
enum class PlayerClass
{
None = 0,
Assault,
Defender,
Sniper
};
struct SpawnRequest
{
int PlayerID;
ComponentInfo::EnumType Team;
PlayerClass Class;
};
bool m_NetworkEnabled = false;
std::vector<SpawnRequest> m_SpawnRequests;
//Player ID -> EntityWrapper.
std::map<int, EntityWrapper> m_PlayerEntities;
//EntityWrapper ID -> Player ID.
std::map<EntityID, int> m_PlayerIDs;
float m_ForcedRespawnTime;
bool m_DbgConfigForceRespawn;
EventRelay<PlayerSpawnSystem, Events::InputCommand> m_OnInputCommand;
bool OnInputCommand(Events::InputCommand& e);
EventRelay<PlayerSpawnSystem, Events::PlayerSpawned> m_OnPlayerSpawnerd;
bool OnPlayerSpawned(Events::PlayerSpawned& e);
EventRelay<PlayerSpawnSystem, Events::PlayerDeath> m_OnPlayerDeath;
bool OnPlayerDeath(Events::PlayerDeath& e);
};