[Orxonox-commit 6237] r10894 - code/branches/hoverHS15/src/modules/hover

meierman at orxonox.net meierman at orxonox.net
Mon Nov 30 15:47:42 CET 2015


Author: meierman
Date: 2015-11-30 15:47:42 +0100 (Mon, 30 Nov 2015)
New Revision: 10894

Added:
   code/branches/hoverHS15/src/modules/hover/HoverFlag.cc
   code/branches/hoverHS15/src/modules/hover/HoverFlag.h
Modified:
   code/branches/hoverHS15/src/modules/hover/CMakeLists.txt
   code/branches/hoverHS15/src/modules/hover/Hover.cc
   code/branches/hoverHS15/src/modules/hover/Hover.h
   code/branches/hoverHS15/src/modules/hover/HoverPrereqs.h
Log:
Flag generator implemented

Modified: code/branches/hoverHS15/src/modules/hover/CMakeLists.txt
===================================================================
--- code/branches/hoverHS15/src/modules/hover/CMakeLists.txt	2015-11-30 14:07:22 UTC (rev 10893)
+++ code/branches/hoverHS15/src/modules/hover/CMakeLists.txt	2015-11-30 14:47:42 UTC (rev 10894)
@@ -3,6 +3,7 @@
 HoverShip.cc
 HoverWall.cc
 HoverOrigin.cc
+HoverFlag.cc
 )
 
 ORXONOX_ADD_LIBRARY(hover

Modified: code/branches/hoverHS15/src/modules/hover/Hover.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.cc	2015-11-30 14:07:22 UTC (rev 10893)
+++ code/branches/hoverHS15/src/modules/hover/Hover.cc	2015-11-30 14:47:42 UTC (rev 10894)
@@ -35,6 +35,7 @@
 #include "Hover.h"
 
 #include "HoverWall.h"
+#include "HoverFlag.h"  
 #include "core/CoreIncludes.h"
 
 #include <iostream>
@@ -44,8 +45,8 @@
 #include <memory.h>
 #include <stdint.h>
 #include <fstream>
+#include <vector>
 
-
 namespace orxonox
 {
     bool firstTick = true;
@@ -139,13 +140,22 @@
             }
 
 
+            for ( int i = 0; i < 5; i++ )
+                flagVector.push_back(new HoverFlag(origin_->getContext(), rand()%10, rand()%10));
             
-            //new HoverWall(origin_->getContext(), 1, 1, 1); //Rechts in Y Richtung
+            //new HoverFlag(origin_->getContext()); //Rechts in Y Richtung
             //new HoverWall(origin_->getContext(), 5, 6, 0); //Ueber in x richtung
             //new HoverWall(origin_->getContext(), 5, 5, 0); //Ueber in x richtung
-        }      
+        }
+        for ( int i = 0; i < flagVector.size(); i++ ){
+            if(flagVector[i]->getCollided()){
+                flagVector[i]->destroyLater();
+                flagVector.erase (flagVector.begin()+i);
+            }
+        }
 
 
+
     }
 
     

Modified: code/branches/hoverHS15/src/modules/hover/Hover.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/Hover.h	2015-11-30 14:07:22 UTC (rev 10893)
+++ code/branches/hoverHS15/src/modules/hover/Hover.h	2015-11-30 14:47:42 UTC (rev 10894)
@@ -102,6 +102,7 @@
             void RenderMaze();
             void MazeOut();
             void LevelOut();
+            std::vector<HoverFlag*> flagVector;
 
 
     };

Added: code/branches/hoverHS15/src/modules/hover/HoverFlag.cc
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverFlag.cc	                        (rev 0)
+++ code/branches/hoverHS15/src/modules/hover/HoverFlag.cc	2015-11-30 14:47:42 UTC (rev 10894)
@@ -0,0 +1,153 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file HoverFlag.cc
+    @brief All platforms in this minigame inherit from this class. The basic functions of a platform (interact with figure) is implemented here. Special functions are implemented in the specialized classes.
+*/
+
+#include "HoverFlag.h"
+#include "HoverShip.h"
+
+#include "core/CoreIncludes.h"
+#include "core/GameMode.h"
+#include "graphics/Model.h"
+#include "gametypes/Gametype.h"
+
+
+
+
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    RegisterClass(HoverFlag);
+
+    HoverFlag::HoverFlag(Context* context) : StaticEntity(context)
+    {
+        RegisterObject(HoverFlag);
+        model_ = NULL;
+        cs_ = NULL;
+    }
+
+    HoverFlag::HoverFlag(Context* context, int xCoordinate, int yCoordinate) : StaticEntity(context)
+    {
+        RegisterObject(HoverFlag);
+        enableCollisionCallback();
+        model_ = NULL;
+        cs_ = NULL;
+
+        model_ = new Model(context);
+        model_->setMeshSource("ss_flag_eu.mesh");
+        model_->setScale3D(Vector3(5, 5, 5));
+        model_->setPosition(Vector3(xCoordinate*100 + 50,10,yCoordinate*100 + 50));
+
+        this->attach(model_);
+
+        this->enableCollisionCallback();
+        this->setCollisionResponse(true);
+        this->setCollisionType(Static);
+
+        cs_ = new BoxCollisionShape(context);
+        cs_->setHalfExtents(Vector3(5, 5, 5));
+        cs_->setPosition(Vector3(xCoordinate*100 + 50,0,yCoordinate*100 + 50));
+
+        this->attachCollisionShape(cs_);
+        this->collided_ = false;
+
+    }
+
+    /**
+    @brief
+        Destructor.
+    */
+    HoverFlag::~HoverFlag()
+    {
+
+    }
+
+    //xml port for loading height and width of the platform
+    void HoverFlag::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(HoverFlag, XMLPort, xmlelement, mode);
+
+       // XMLPortParam(HoverFlag, "height", setHeight, getHeight, xmlelement, mode);
+        //XMLPortParam(HoverFlag, "width", setWidth, getWidth, xmlelement, mode);
+    }
+
+
+
+
+    /**
+    @brief
+        Is called every tick.
+        Handles the movement of the ball and its interaction with the boundaries and bats.
+    @param dt
+        The time since the last tick.
+    */
+    void HoverFlag::tick(float dt)
+    {
+        SUPER(HoverFlag, tick, dt);
+        
+    }
+
+    bool HoverFlag::collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint)
+    {
+        
+
+        if(otherObject->isA(Class(HoverShip))){
+
+            orxout()<<"TestCollision"<<endl;
+            collided_ = true;
+            //this->destroyLater();
+        }
+
+
+        /*if (GameMode::isMaster() && enableCollisionDamage_)
+        {
+            Pawn* victim = orxonox_cast<Pawn*>(otherObject);
+            if (victim)
+            {
+                float damage = this->collisionDamage_ * (victim->getVelocity() - this->getVelocity()).length();
+                victim->hit(0, contactPoint, ownCollisionShape, damage);
+            }
+        }*/
+
+        return false;
+    }
+
+    bool HoverFlag::getCollided(){
+        return collided_;
+    }
+
+    void HoverFlag::setCollided(bool setValue){
+        collided_ = setValue;
+    }
+    
+    
+}

Added: code/branches/hoverHS15/src/modules/hover/HoverFlag.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverFlag.h	                        (rev 0)
+++ code/branches/hoverHS15/src/modules/hover/HoverFlag.h	2015-11-30 14:47:42 UTC (rev 10894)
@@ -0,0 +1,67 @@
+/*
+ *   ORXONOX - the hottest 3D action shooter ever to exist
+ *                    > www.orxonox.net <
+ *
+ *
+ *   License notice:
+ *
+ *   This program is free software; you can redistribute it and/or
+ *   modify it under the terms of the GNU General Public License
+ *   as published by the Free Software Foundation; either version 2
+ *   of the License, or (at your option) any later version.
+ *
+ *   This program is distributed in the hope that it will be useful,
+ *   but WITHOUT ANY WARRANTY; without even the implied warranty of
+ *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ *   GNU General Public License for more details.
+ *
+ *   You should have received a copy of the GNU General Public License
+ *   along with this program; if not, write to the Free Software
+ *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
+ *
+ *   Author:
+ *      Fabien Vultier
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file HoverFlag.h
+    @brief Declaration of the HoverFlag class.
+    @ingroup Jump
+*/
+
+#ifndef _HoverFlag_H__
+#define _HoverFlag_H__
+
+#include "HoverPrereqs.h"
+#include "util/Math.h"
+#include "worldentities/StaticEntity.h"
+#include "graphics/Model.h"    
+#include "objects/collisionshapes/BoxCollisionShape.h"
+
+
+namespace orxonox
+{
+    class _HoverExport HoverFlag : public StaticEntity
+    {
+        public:
+            HoverFlag(Context* context);
+            HoverFlag(Context* context, int xCoordinate, int yCoordinate);
+            virtual bool collidesAgainst(WorldEntity* otherObject, const btCollisionShape* ownCollisionShape, btManifoldPoint& contactPoint);            
+            virtual ~HoverFlag();
+            virtual void tick(float dt);
+            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+            bool getCollided();
+            void setCollided(bool setValue);
+
+        private:
+            Model* model_;
+            BoxCollisionShape* cs_;
+            bool collided_;
+
+    };
+}
+
+#endif /* _HoverFlag_H__ */

Modified: code/branches/hoverHS15/src/modules/hover/HoverPrereqs.h
===================================================================
--- code/branches/hoverHS15/src/modules/hover/HoverPrereqs.h	2015-11-30 14:07:22 UTC (rev 10893)
+++ code/branches/hoverHS15/src/modules/hover/HoverPrereqs.h	2015-11-30 14:47:42 UTC (rev 10894)
@@ -71,6 +71,7 @@
     class HoverShip;
     class HoverWall;
     class HoverOrigin;
+    class HoverFlag;
 }
 
 #endif /* _HoverPrereqs_H__*/




More information about the Orxonox-commit mailing list