[Orxonox-commit 6186] r10844 - code/branches/campaignHS15/src/orxonox/worldentities

gania at orxonox.net gania at orxonox.net
Mon Nov 23 21:12:23 CET 2015


Author: gania
Date: 2015-11-23 21:12:23 +0100 (Mon, 23 Nov 2015)
New Revision: 10844

Added:
   code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc
   code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h
Log:
same as above

Added: code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc	                        (rev 0)
+++ code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.cc	2015-11-23 20:12:23 UTC (rev 10844)
@@ -0,0 +1,113 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+#include "ActionPoint.h"
+
+#include "core/CoreIncludes.h"
+#include "core/XMLPort.h"
+
+namespace orxonox
+{
+    RegisterClass(ActionPoint);
+
+    ActionPoint::ActionPoint(Context* context) : StaticEntity(context)
+    {
+        RegisterObject(ActionPoint);
+
+    }
+    //usage:
+    // <DivisionController team=12>
+    //     <actionpoints>
+    //          <ActionPoint position="12,34,56" action="FIGHT" enemy="enemyName" />, position irrelevant
+    //          <ActionPoint position="12,34,56" action="PROTECT" protect="protectName" />, position irrelevant
+    //          <ActionPoint position="12,34,56" action="FLY" />, position relevant: makes ship fly to the position of ActionPoint
+    //     </actionpoints>
+    // </DivisonController>
+    //DivisionController will firstly fight enemy that it will find by name "enemyName", if finds nothing or when beats enemy,
+    //it will protect ship that it will find by name "protectName", when it's dead or if it doesn't find the ship,
+    //it will fly towards "12,34,56"
+    //when it finishes all, it stays at that location.
+    //At all the times it will check if there are enemies near DivisionController, if yes, it will fight them
+    //another usage:
+    // <DivisionController team=12>
+    //     <actionpoints>
+    //          <ActionPoint position="12,34,56" action="PROTECT" protectMe=true />, position irrelevant
+    //          <ActionPoint position="12,34,56" action="FIGHT" fightAll=true />, position irrelevant
+    //     </actionpoints>
+    // </DivisonController>
+    //DivisionController will protect the first NewHumanController it finds, when it dies or if no controller found,
+    //it will fight closest enemies one after another
+    void ActionPoint::XMLPort(Element& xmlelement, XMLPort::Mode mode)
+    {
+        SUPER(ActionPoint, XMLPort, xmlelement, mode);
+        
+        XMLPortParam( ActionPoint, "action", setActionXML, getActionXML,  xmlelement, mode );
+        XMLPortParam( ActionPoint, "protect", setProtectXML, getProtectXML,  xmlelement, mode );
+        XMLPortParam( ActionPoint, "enemy", setEnemyXML, getEnemyXML,  xmlelement, mode );
+        XMLPortParam( ActionPoint, "protectMe", setProtectMeXML, getProtectMeXML,  xmlelement, mode ).defaultValues(false);
+        XMLPortParam( ActionPoint, "fightAll", setFightAllXML, getFightAllXML,  xmlelement, mode ).defaultValues(false);
+
+    }
+    void ActionPoint::setActionXML( std::string val)
+    {
+        this->actionName_ = getUppercase( val );
+    }
+
+    std::string ActionPoint::getActionXML()
+    {
+        return this->actionName_;
+    }
+    void ActionPoint::setProtectXML( std::string val)
+    {
+        this->protectName_ = getUppercase( val );
+    }
+
+    std::string ActionPoint::getProtectXML()
+    {
+        return this->protectName_;
+    }
+    void ActionPoint::setEnemyXML( std::string val)
+    {
+        this->enemyName_ = getUppercase( val );
+    }
+
+    std::string ActionPoint::getEnemyXML()
+    {
+        return this->enemyName_;
+    }
+
+    void ActionPoint::setTargetPosition(const Vector3& target)
+    {
+        this->targetPosition_ = target;
+    }
+    Vector3 ActionPoint::getTargetPosition ()
+    {
+        return this->targetPosition_;
+    }
+    
+}

Added: code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h
===================================================================
--- code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h	                        (rev 0)
+++ code/branches/campaignHS15/src/orxonox/worldentities/ActionPoint.h	2015-11-23 20:12:23 UTC (rev 10844)
@@ -0,0 +1,106 @@
+/*
+ *   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:
+ *      Fabian 'x3n' Landau
+ *   Co-authors:
+ *      ...
+ *
+ */
+
+/**
+    @file Attacher.h
+    @brief Definition of the Attacher class.
+    @ingroup Objects
+*/
+
+#ifndef _ActionPoint_H__
+#define _ActionPoint_H__
+
+#include "OrxonoxPrereqs.h"
+
+#include <list>
+#include <string>
+#include "core/XMLNameListener.h"
+#include "worldentities/StaticEntity.h"
+namespace orxonox
+{
+ 
+    class _OrxonoxExport ActionPoint : public StaticEntity
+    {
+        public:
+            ActionPoint(Context* context);
+            virtual ~ActionPoint() {}
+
+            //----[XML data]----
+                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
+                //----[Action data]----
+                    void setActionXML( std::string val);
+                    std::string getActionXML();
+                //----[/Action data]----
+                //----[Protect data]----
+                    void setProtectXML( std::string val);
+                    std::string getProtectXML();
+                //----[/Protect data]----
+                //----[Enemy data]----
+                    void setEnemyXML( std::string val);
+                    std::string getEnemyXML();
+                //----[/Enemy data]----
+                //----[ProtectMe data]----
+                    inline void setProtectMeXML(bool c)
+                    {
+                        this->protectMe_ = c;
+                    }
+                    inline bool getProtectMeXML ()
+                    {
+                        return this->protectMe_;
+                    }
+
+                //----[/ProtectMe data]----
+                //----[FightAll data]----
+                    inline void setFightAllXML(bool c)
+                    {
+                        this->fightAll_ = c;
+                    }
+                    inline bool getFightAllXML ()
+                    {
+                        return this->fightAll_;
+                    }
+                //----[/FightAll data]----
+            //----[/XML data]----
+
+            //----["Waypoints" data]----
+                void setTargetPosition(const Vector3& target);
+                Vector3 getTargetPosition ();
+            //----[/"Waypoints" data]----
+
+        private:
+            
+            std::string actionName_;
+            std::string protectName_;
+            std::string enemyName_;
+            bool protectMe_;
+            bool fightAll_;
+            Vector3 targetPosition_;
+    };
+}
+
+#endif /* _ActionPoint_H__ */




More information about the Orxonox-commit mailing list