Saxum/trigger.cc

26 lines
675 B
C++
Raw Normal View History

#include "trigger.hh"
Trigger::Trigger(glm::vec3 position, float distance, bool isBigger, Object* object, void (*functionPointer)(Level*), Level* level) {
this->position=position;
this->distance=distance;
this->isBigger=isBigger;
this->object=object;
this->functionPointer = functionPointer;
this->level = level;
}
Trigger::Trigger(){
}
Trigger::~Trigger(){
}
void Trigger::triggerUpdate(){
2014-12-15 17:43:10 +00:00
if (isBigger && (glm::distance(object->getPosition(), position) > distance)) {
(*functionPointer)(level);
2014-12-15 17:43:10 +00:00
}
else if (!isBigger && (glm::distance(object->getPosition(), position) < distance)) {
(*functionPointer)(level);
2014-12-15 17:43:10 +00:00
}
}