Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/3DPacman_FS18/src/modules/Pacman/PacmanGhost.h @ 11849

Last change on this file since 11849 was 11849, checked in by dreherm, 7 years ago

Ghost Check 5

  • Property svn:executable set to *
File size: 5.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 *      Oli Scheuss
24 *   Co-authors:
25 *      Damian 'Mozork' Frick
26 *
27 */
28
29#ifndef _PacmanGhost_H__
30#define _PacmanGhost_H__
31
32#include "OrxonoxPrereqs.h"
33
34#include "core/XMLPort.h"
35
36#include "worldentities/ControllableEntity.h"
37
38namespace orxonox {
39
40    class _OrxonoxExport PacmanGhost : public ControllableEntity
41    {
42        public:
43            PacmanGhost(Context* context);
44            virtual ~PacmanGhost();
45
46            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode); //!< Method for creating an AutonomousDrone through XML.
47            virtual void tick(float dt); //!< Defines which actions the AutonomousDrone has to take in each tick.
48
49            virtual void moveFrontBack(const Vector2& value);
50            virtual void moveRightLeft(const Vector2& value);
51            virtual void moveUpDown(const Vector2& value);
52
53            virtual void rotateYaw(const Vector2& value);
54            virtual void rotatePitch(const Vector2& value);
55            virtual void rotateRoll(const Vector2& value);
56
57            void PacmanGhost::move(float dt, Vector3 actuelposition, Vector3 velocity);
58           
59            //virtual void resetGhost();
60            /**
61            @brief Moves the Drone in the Front/Back-direction by the specifed amount.
62            @param value  The amount by which the drone is to be moved.
63            */
64            inline void moveFrontBack(float value)
65            { this->moveFrontBack(Vector2(value, 0)); }
66            /**
67            @brief Moves the Drone in the Right/Left-direction by the specifed amount.
68            @param value  The amount by which the drone is to be moved.
69            */
70            inline void moveRightLeft(float value)
71            { this->moveRightLeft(Vector2(value, 0)); }
72            /**
73            @brief Moves the Drone in the Up/Down-direction by the specifed amount.
74            @param value  The amount by which the drone is to be moved.
75            */
76            inline void moveUpDown(float value)
77            { this->moveUpDown(Vector2(value, 0)); }
78
79            /**
80            @brief Rotates the Drone around the y-axis by the specifed amount.
81            @param value  The amount by which the drone is to be rotated.
82            */
83            inline void rotateYaw(float value)
84            { this->rotateYaw(Vector2(value, 0)); }
85            /**
86            @brief Rotates the Drone around the x-axis by the specifed amount.
87            @param value  The amount by which the drone is to be rotated.
88            */
89            inline void rotatePitch(float value)
90            { this->rotatePitch(Vector2(value, 0)); }
91            /**
92            @brief Rotates the Drone around the z-axis by the specifed amount.
93            @param value  The amount by which the drone is to be rotated.
94            */
95            inline void rotateRoll(float value)
96            { this->rotateRoll(Vector2(value, 0)); }
97
98            /**
99            @brief Sets the primary thrust to the input amount.
100            @param thrust The amount of thrust.
101            */
102            inline void setPrimaryThrust( float thrust )
103                { this->primaryThrust_ = thrust; }
104            inline void setAuxiliaryThrust( float thrust )
105                { this->auxiliaryThrust_ = thrust; }
106            inline void setRotationThrust( float thrust )
107                { this->rotationThrust_ = thrust; }
108
109            inline void setResetPosition(Vector3 rpos)
110                { this->resetposition = rpos; }   
111     
112            /**
113            @brief Gets the primary thrust to the input amount.
114            @return The amount of thrust.
115            */
116            inline float getPrimaryThrust()
117                { return this->primaryThrust_; }
118            inline float getAuxiliaryThrust()
119                { return this->auxiliaryThrust_; }
120            inline float getRotationThrust()
121                { return this->rotationThrust_; }
122           
123            inline Vector3 getResetPosition()
124               { return this->resetposition; }       
125
126
127
128        private:
129           
130            btVector3 localLinearAcceleration_; //!< The linear acceleration that is used to move the AutonomousDrone the next tick.
131            btVector3 localAngularAcceleration_; //!< The linear angular acceleration that is used to move the AutonomousDrone the next tick.
132            float primaryThrust_=100; //!< The amount of primary thrust. This is just used, when moving forward.
133            float auxiliaryThrust_=100; //!< The amount of auxilliary thrust. Used for all other movements (except for rotations).
134            float rotationThrust_=100; //!< The amount of rotation thrust. Used for rotations only.s
135            //Vector3 resetposition; //Start position for Ghost
136       
137            PacmanGhost* myGhost = nullptr;
138
139            bool ismoving = false;
140            int target_x = 0; 
141            int target_z = 0; 
142            Vector3 actuelposition;
143            Vector3 velocity;
144            Vector3 resetposition;
145    };
146
147}
148
149#endif
Note: See TracBrowser for help on using the repository browser.