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