HealthSystem now deletes the entity after publishing the PlayerDeath event

This commit is contained in:
verysecrethero
2016-01-21 14:25:01 +01:00
parent 70cab9ef30
commit 2381f01d12
+3 -1
View File
@@ -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;
}