Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/campaignHS15/src/orxonox/controllers/ActionpointController.h @ 10864

Last change on this file since 10864 was 10864, checked in by gania, 8 years ago

split up some code

File size: 3.8 KB
Line 
1/*
2 *   ORXONOX - the hottest 3D action shooter ever to exist
3 *                    > www.orxonox.net <
4 *
5 *
6 *   License notice:
7 *
8 *   This program is free software; you can redistribute it and/or
9 *   modify it under the terms of the GNU General Public License
10 *   as published by the Free Software Foundation; either version 2
11 *   of the License, or (at your option) any later version.
12 *
13 *   This program is distributed in the hope that it will be useful,
14 *   but WITHOUT ANY WARRANTY; without even the implied warranty of
15 *   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
16 *   GNU General Public License for more details.
17 *
18 *   You should have received a copy of the GNU General Public License
19 *   along with this program; if not, write to the Free Software
20 *   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
21 *
22 *   Author:
23 *      Fabian 'x3n' Landau
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _ActionpointController_H__
30#define _ActionpointController_H__
31
32#include "controllers/CommonController.h"
33
34
35namespace orxonox
36{
37    namespace Action
38    { 
39        enum Value
40        {
41            NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
42        };
43       
44    }
45   
46    struct Point {
47        Action::Value action;
48        std::string name;
49        Vector3 position;
50        bool inLoop;
51    } ;
52
53    class _OrxonoxExport ActionpointController : public CommonController
54    {
55        public:
56            //----[language demanded functions]----           
57                ActionpointController(Context* context);
58                virtual ~ActionpointController();
59            //----[language demanded functions]----           
60                virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
61               
62            virtual void tick(float dt); 
63            void addActionpoint(WorldEntity* waypoint);
64            WorldEntity* getActionpoint(unsigned int index) const;           
65            virtual void stayNearProtect();
66            virtual void action(); //<! action() is called in regular intervals managing the bot's behaviour.
67            virtual void takeActionpoints (std::vector<Point > vector, std::vector<Point > loop, bool b);
68            Action::Value getAction ();
69            std::string getActionName();
70
71            void setAction (Action::Value action);
72            void setAction (Action::Value action, ControllableEntity* target);
73            void setAction (Action::Value action, const Vector3& target);
74            void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
75
76           
77
78
79        protected:
80            void startAttackingEnemiesThatAreClose();
81
82            //----[Actionpoint information]----
83                Action::Value action_;
84                std::string protectName_;
85                std::string targetName_;
86                std::vector<WeakPtr<WorldEntity> > actionpoints_;
87                float squaredaccuracy_;
88                std::vector<Point > parsedActionpoints_;
89                std::vector<Point > loopActionpoints_;
90                bool bInLoop_;
91                bool bLoop_;   
92                bool bEndLoop_; 
93                bool bTakenOver_; 
94            //----[/Actionpoint information]----
95                void setProtect (ControllableEntity* protect);
96                ControllableEntity* getProtect (); 
97                void setClosestTarget();
98                Pawn* closestTarget();
99            //----[Actionpoint methods]----
100                void executeActionpoint();
101                void nextActionpoint();
102                void fillLoop();
103                void fillLoopReversed();
104                void moveBackToTop();
105            //----[Actionpoint methods]----         
106           
107        private:
108           
109    };
110}
111
112#endif /* _ActionpointController_H__ */
Note: See TracBrowser for help on using the repository browser.