From 2381f01d124cd4694dd6fcdea507ceb17e4a47fa Mon Sep 17 00:00:00 2001 From: verysecrethero Date: Thu, 21 Jan 2016 14:25:01 +0100 Subject: [PATCH] HealthSystem now deletes the entity after publishing the PlayerDeath event --- src/Game/Systems/HealthSystem.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/Game/Systems/HealthSystem.cpp b/src/Game/Systems/HealthSystem.cpp index 121d6446..7d4b96b8 100644 --- a/src/Game/Systems/HealthSystem.cpp +++ b/src/Game/Systems/HealthSystem.cpp @@ -37,7 +37,8 @@ void HealthSystem::UpdateComponent(World* world, EntityWrapper& entity, Componen if (std::get<0>(m_DeltaHealthVector[j - 1]) == component.EntityID) m_DeltaHealthVector.erase(m_DeltaHealthVector.begin() + j - 1); } - //break the loop if the player is dead + //delete the player and break the loop + world->DeleteEntity(entity.ID); break; } } @@ -57,3 +58,4 @@ bool HealthSystem::OnPlayerHealthPickup(const Events::PlayerHealthPickup& e) m_DeltaHealthVector.push_back(std::make_tuple(e.PlayerHealedID, e.HealthAmount)); return true; } +