Changed System to take World through constructor and store it instead, cause it makes more sense.
This commit is contained in:
@@ -1,7 +1,7 @@
|
||||
#include "Systems/HealthSystem.h"
|
||||
|
||||
HealthSystem::HealthSystem(EventBroker* eventBroker)
|
||||
: System(eventBroker)
|
||||
HealthSystem::HealthSystem(World* m_World, EventBroker* eventBroker)
|
||||
: System(m_World, eventBroker)
|
||||
, PureSystem("Health")
|
||||
{
|
||||
//subscribe/listenTo playerdamage,healthpickup events (using the eventBroker)
|
||||
@@ -9,10 +9,10 @@ HealthSystem::HealthSystem(EventBroker* eventBroker)
|
||||
EVENT_SUBSCRIBE_MEMBER(m_EPlayerHealthPickup, &HealthSystem::OnPlayerHealthPickup);
|
||||
}
|
||||
|
||||
void HealthSystem::UpdateComponent(World* world, EntityWrapper& entity, ComponentWrapper& component, double dt)
|
||||
void HealthSystem::UpdateComponent(EntityWrapper& entity, ComponentWrapper& component, double dt)
|
||||
{
|
||||
//if entityID of health is 9 then the players ID is also 9 (player,health are connected to the same entity)
|
||||
ComponentWrapper player = world->GetComponent(component.EntityID, "Player");
|
||||
ComponentWrapper player = m_World->GetComponent(component.EntityID, "Player");
|
||||
double maxHealth = (double)component["MaxHealth"];
|
||||
|
||||
//process the DeltaHealthVector and change the entitys health accordingly
|
||||
|
||||
Reference in New Issue
Block a user