]> git.leopard-lacewing.eu Git - cgue_weave.git/commitdiff
Boar revives when time reverted
authorLockedLunatic <locked.lunatic@aon.at>
Tue, 28 Jun 2016 04:30:24 +0000 (06:30 +0200)
committerLockedLunatic <locked.lunatic@aon.at>
Tue, 28 Jun 2016 04:30:24 +0000 (06:30 +0200)
Weave/Scene/Boar.cpp
Weave/Scene/Boar.h
Weave/Scene/Scene.cpp

index 9b1c76f70f102f72f31692e3180b54a4f030f3b2..aebc28bb81d2e37636c4951120378fbcc5f0ca66 100644 (file)
@@ -21,6 +21,7 @@ Boar::Boar(const mat4& _modelMat) :
 
 Boar::~Boar()
 {
+
 }
 
 void Boar::update(float _deltaT)
@@ -137,6 +138,11 @@ void Boar::collides(SceneObject * _other, btPersistentManifold * _contactManifol
                //BOAR DIE!!!
                alive = false;
 
+               if (!timeresistant)
+               {
+                       mainScene->addEvent(this, 5);
+               }
+
                _other->move(-pdist * (float).5 *  vec3(0.f, normal[1], 0.f));
        }
 
@@ -158,3 +164,8 @@ void Boar::collides(SceneObject * _other, btPersistentManifold * _contactManifol
        activated = true;
        
 }
+
+void Boar::revive()
+{
+       alive = true;
+}
\ No newline at end of file
index fc3b8079a5fdf5373b4289b1b2ee51f3d3a5528a..70058e79e22522430767743bbf527c5a3eaadc40 100644 (file)
@@ -14,6 +14,7 @@ public:
        //virtual void draw(drawTarget target = DRAW_Model) const override;
 
        virtual void collides(SceneObject* other, btPersistentManifold* contactManifold, float deltaT = 1.f) override;
+       void revive();
 
 protected:
        bool activated = false;
index 76fc7b977c4eb492b925ab105a234bbde172366a..75917db4ef2e84c65b408d4cbf81e57ef35af99d 100644 (file)
@@ -1,6 +1,7 @@
 #include "Scene.h"
 #include "SceneObject.h"
 #include "Lever.h"
+#include "Boar.h"
 //#include "Sky.h"
 //#include "Camera.h"
 #include <GL\glew.h>
@@ -666,5 +667,13 @@ void Scene::revertEvent(TimeEvent e)
                        l->reverseSpeed();
                }
                break;
+
+       case 5:
+               //Boar revived
+               if (Boar* l = dynamic_cast<Boar*> (e.object))
+               {
+                       l->revive();
+               }
+               break;
        }
 }
\ No newline at end of file