A "Respawn" componet which automatically triggers a Spawner component when the last respawned entity of that spawner is destroyed

This commit is contained in:
2016-03-09 23:48:41 +01:00
parent 123fbf5633
commit 4b6d4e581f
8 changed files with 81 additions and 1 deletions
+22
View File
@@ -0,0 +1,22 @@
#ifndef RespawnSystem_h__
#define RespawnSystem_h__
#include "System.h"
#include "SpawnerSystem.h"
#include "EEntityDeleted.h"
class RespawnSystem : public PureSystem
{
public:
RespawnSystem(SystemParams params);
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cRespawn, double dt) override;
private:
std::unordered_map<EntityWrapper, EntityWrapper> m_LastRespawnedEntity;
EventRelay<RespawnSystem, Events::EntityDeleted> m_EEntityDeleted;
bool OnEntityDeleted(const Events::EntityDeleted& e);
};
#endif
+1 -1
View File
@@ -68,7 +68,7 @@ protected:
const std::string m_ComponentType;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& scoreScreen, double dt) = 0;
virtual void UpdateComponent(EntityWrapper& entity, ComponentWrapper& cComponent, double dt) = 0;
};
class ImpureSystem : public virtual System