#include "PowerupComponent.h" #include "GameInternal.h" #include "CollisionHandler.h" #include "Entity.h" #include "HealthComponent.h" #include "StatEffectsComponent.h" #include "Constants.h" #include PowerupComponent::PowerupComponent(std::function func) { this->pickupFunc = func; } void PowerupComponent::update(uint_fast16_t diffTime) { Entity* player; if ((player = this->entity->getManager().getGame()->collisionHandler->getAnyIntersection( entity, Vector2D(0, 0), { Entity::GroupLabel::PLAYERS })) != nullptr) { (this->pickupFunc)(player); this->entity->destroy(); } }