28 lines
656 B
C++
28 lines
656 B
C++
#include "components/HazardComponent.hpp"
|
|
|
|
#include "Entity.hpp"
|
|
#include "components/ColliderComponent.hpp"
|
|
|
|
void HazardComponent::Setup() {
|
|
auto selfCollider = entity->GetComponent<ColliderComponent>();
|
|
if (!selfCollider) {
|
|
return;
|
|
}
|
|
|
|
selfCollider->get().monitoring = true;
|
|
|
|
selfCollider->get().AddCollisionListener([this](Entity &other) {
|
|
if (!context || !context->probeEntity || &other != context->probeEntity) {
|
|
return;
|
|
}
|
|
|
|
if (context->onPlayerDeath) {
|
|
context->onPlayerDeath();
|
|
}
|
|
});
|
|
}
|
|
|
|
void HazardComponent::Update(float) {}
|
|
|
|
void HazardComponent::Cleanup() {}
|