Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

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

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

added other weapons

File size: 4.4 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 *      Gani Aliguzhinov
24 *   Co-authors:
25 *      ...
26 *
27 */
28
29#ifndef _ActionpointController_H__
30#define _ActionpointController_H__
31
32#include "controllers/FightingController.h"
33#include "tools/Timer.h"
34#include "tools/interfaces/Tickable.h"
35
36namespace orxonox
37{
38    namespace Action
39    { 
40        enum Value
41        {
42            NONE, FLY, FIGHT, PROTECT, FIGHTALL, ATTACK
43        };
44       
45    }
46   
47    struct Point {
48        Action::Value action;
49        std::string name;
50        Vector3 position;
51        bool inLoop;
52    } ;
53
54    class _OrxonoxExport ActionpointController : public FightingController, public Tickable
55    {
56        public:
57            ActionpointController(Context* context);
58            virtual ~ActionpointController();
59            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);         
60               
61            virtual void tick(float dt);
62
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 (const std::vector<Point>& vector, const std::vector<Point>& loop, bool b);
68
69            virtual Action::Value getAction ();
70            virtual std::string getActionName();
71
72            void setAction (Action::Value action);
73            void setAction (Action::Value action, ControllableEntity* target);
74            void setAction (Action::Value action, const Vector3& target);
75            void setAction (Action::Value action, const Vector3& target,  const Quaternion& orient );
76
77            virtual bool setWingman(ActionpointController* wingman)
78                { return false; }
79            virtual bool hasWingman()
80                { return true; }
81            virtual bool setFollower(ActionpointController* myFollower)
82                { return false; }
83            virtual bool hasFollower()
84                { return true; }
85               
86        protected:
87                void startAttackingEnemiesThatAreClose();
88                WeakPtr<ActionpointController> myWingman_;
89                WeakPtr<ActionpointController> myFollower_;
90                WeakPtr<ActionpointController> myDivisionLeader_;
91            //----[Actionpoint information]----
92                Action::Value action_;
93                std::string protectName_;
94                std::string targetName_;
95                std::vector<WeakPtr<WorldEntity> > actionpoints_;
96                float squaredaccuracy_;
97                std::vector<Point > parsedActionpoints_;
98                std::vector<Point > loopActionpoints_;
99                bool bInLoop_;
100                bool bLoop_;   
101                bool bEndLoop_; 
102                bool bTakenOver_; 
103            //----[/Actionpoint information]----
104                void setProtect (ControllableEntity* protect);
105                ControllableEntity* getProtect (); 
106                WeakPtr<ControllableEntity> protect_;     
107                void fillLoop();
108                void fillLoopReversed();
109                void moveBackToTop();
110                void setClosestTarget();
111                Pawn* closestTarget();
112            //----[Actionpoint methods]----
113                void executeActionpoint();
114                void nextActionpoint();
115                void pushAction(Point& p);
116                void popAction();
117            //----[Actionpoint methods]----         
118                bool bFirstTick_; 
119
120        private:
121           
122    };
123}
124
125#endif /* _ActionpointController_H__ */
Note: See TracBrowser for help on using the repository browser.