void Boar::collides(SceneObject * _other, btPersistentManifold * _contactManifold, float _deltaT)
{
- if (_other->collide_group != COL_MARVIN)
+ if (_other->collide_group != COL_MARVIN && _other->collide_group != COL_ENEMY)
return;
if (activated)
eb_type(_EB_TYPE)
{
collide_group = COL_EVENT;
- collide_with = COL_MARVIN;
+ collide_with = COL_MARVIN ;
if (eb_type == EB_LEVER)
collide_with = COL_LEVER;
void EventBox::update(float _deltaT)
{
+ SceneObject::update(_deltaT);
if (activated)
{
- if (nextFrame)
+ triggertime += _deltaT;
+
+ if (triggertime >= 1.f)
+ {
activated = false;
- else
- nextFrame = true;
- }
+ }
+
+ }
+
}
void EventBox::draw(drawTarget _target) const
void EventBox::collides(SceneObject* _other, btPersistentManifold* _contactManifold, float _deltaT)
{
if (activated)
- {
- nextFrame = false;
return;
- }
switch (eb_type)
{
((Lever*)_other)->trigger();
break;
}
-
+
activated = true;
+ triggertime = 0;
}
eventBoxType eb_type;
bool activated = false;
- bool nextFrame = true;
+ float triggertime = 0;
};
#include "Lever.h"
#include "Scene.h"
+#include "../Message.h"
Lever::Lever(const mat4& _modelMat, const vec4& _material, string _modelpath, string texturepath) : SceneObject(_modelMat, _material, _modelpath, texturepath)
{
collide_with = COL_EVENT;
}
-Lever::Lever(const mat4& modelMat, const vec4& material, Model* model, string texturepath) : SceneObject(modelMat, material, model, texturepath)
-{
- recipient = nullptr;
- collide_group = COL_LEVER;
- collide_with = COL_EVENT;
-}
-
Lever::~Lever()
{
{
public:
Lever(const mat4& _modelMat, const vec4& _material, string _modelpath, string texturepath);
- Lever(const mat4& modelMat, const vec4& material, Model* model, string texturepath);
~Lever();
void setup(SceneObject* object);
void trigger();