Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/surfaceRace/src/orxonox/controllers/ArtificialController.h @ 9206

Last change on this file since 9206 was 9016, checked in by jo, 13 years ago

Merging presentation2011 branch to trunk. Please check for possible bugs.

  • Property svn:eol-style set to native
File size: 3.6 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 *      Dominik Solenicki
26 *
27 */
28
29#ifndef _ArtificialController_H__
30#define _ArtificialController_H__
31
32#include "OrxonoxPrereqs.h"
33#include "controllers/FormationController.h"
34
35
36namespace orxonox
37{
38    class _OrxonoxExport ArtificialController : public FormationController
39    {
40        public:
41            ArtificialController(BaseObject* creator);
42            virtual ~ArtificialController();
43
44            void abandonTarget(Pawn* target);
45
46            virtual void changedControllableEntity();
47
48            virtual void doFire();
49            void setBotLevel(float level=1.0f);
50            inline float getBotLevel() const
51                { return this->botlevel_; }
52            static void setAllBotLevel(float level);
53            //WAYPOINT FUNCTIONS
54            void addWaypoint(WorldEntity* waypoint);
55            WorldEntity* getWaypoint(unsigned int index) const;
56
57            inline void setAccuracy(float accuracy)
58                { this->squaredaccuracy_ = accuracy*accuracy; }
59            inline float getAccuracy() const
60                { return sqrt(this->squaredaccuracy_); }
61            void updatePointsOfInterest(std::string name, float distance);
62            void manageWaypoints();
63
64           
65
66        protected:
67           
68            void aimAtTarget();
69
70            bool isCloseAtTarget(float distance) const;
71            bool isLookingAtTarget(float angle) const;
72
73            float botlevel_; //<! Makes the level of a bot configurable.
74            enum Mode {DEFAULT, ROCKET, DEFENCE, MOVING};//TODO; implement DEFENCE, MOVING modes
75            Mode mode_; //TODO: replace single value with stack-like implementation: std::vector<Mode> mode_;
76            void setPreviousMode();
77
78
79            //WEAPONSYSTEM DATA
80            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
81            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
82            float timeout_; //<! Timeout for rocket usage. (If a rocket misses, a bot should stop using it.)
83            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
84            bool bSetupWorked; //<! If false, setupWeapons() is called.
85            int getFiremode(std::string name);
86
87
88            //WAYPOINT DATA
89            std::vector<WeakPtr<WorldEntity> > waypoints_;
90            size_t currentWaypoint_;
91            float squaredaccuracy_;
92            WorldEntity* defaultWaypoint_;
93
94            void boostControl(); //<! Sets and resets the boost parameter of the spaceship. Bots alternate between boosting and saving boost.
95
96        private:
97    };
98}
99
100#endif /* _ArtificialController_H__ */
Note: See TracBrowser for help on using the repository browser.