Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/campaignHS15/src/orxonox/controllers/FightingController.h @ 10886

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

improved dodging

File size: 3.2 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 *      Fabian 'x3n' Landau, Dominik Solenicki
26 *
27 */
28
29#ifndef _FightingController_H__
30#define _FightingController_H__
31
32
33#include "controllers/FlyingController.h"
34
35namespace orxonox
36{
37    class _OrxonoxExport FightingController : public FlyingController
38    {
39
40        public:
41            FightingController(Context* context);
42            virtual ~FightingController();
43           
44            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
45       
46            float squaredDistanceToTarget() const;
47            bool isLookingAtTarget(float angle) const;
48            bool hasTarget() const;
49            ControllableEntity* getTarget() const
50                { return this->target_; }
51            bool bKeepFormation_;
52           
53        protected:
54            void setTarget(ControllableEntity* target);
55
56            void setPositionOfTarget(const Vector3& target);
57            void setOrientationOfTarget(const Quaternion& orient);
58            void stopLookingAtTarget();
59            void startLookingAtTarget();
60            void lookAtTarget(float dt);
61
62            void maneuver();
63            void dodge(const Vector3& thisPosition, Vector3& diffUnit);
64            bool canFire();
65            void doFire();
66            WeakPtr<ControllableEntity> target_;
67            void setClosestTarget();
68         
69            bool bHasPositionOfTarget_;
70            Vector3 positionOfTarget_;
71            bool bHasOrientationOfTarget_;
72            Quaternion orientationOfTarget_;
73            Pawn* closestTarget() const;
74
75            int attackRange_;
76            bool bShooting_;
77            int maneuverCounter_;   
78            bool bLookAtTarget_; 
79            float deltaHp;
80            float previousHp;
81            //WEAPONSYSTEM DATA
82            int rocketsLeft_;
83            float timeout_;
84            bool bFiredRocket_;
85            std::map<std::string, int> weaponModes_; //<! Links each "weapon" to it's weaponmode - managed by setupWeapons()
86            //std::vector<int> projectiles_; //<! Displays amount of projectiles of each weapon. - managed by setupWeapons()
87            void setupWeapons(); //<! Defines which weapons are available for a bot. Is recalled whenever a bot was killed.
88            bool bSetupWorked; //<! If false, setupWeapons() is called.
89            int getFiremode(std::string name);
90         
91    };
92}
93
94#endif /* _FightingController_H__ */
Note: See TracBrowser for help on using the repository browser.