Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/pickupsFS14/src/modules/jump/JumpFigure.h @ 10066

Last change on this file since 10066 was 10050, checked in by fvultier, 11 years ago

Added a whole bunch of code

File size: 4.7 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 *      ...
26 *
27 */
28
29/**
30    @file JumpFigure.h
31    @brief Declaration of the JumpFigure class.
32    @ingroup Jump
33*/
34
35#ifndef _JumpFigure_H__
36#define _JumpFigure_H__
37
38#include "jump/JumpPrereqs.h"
39
40#include "worldentities/ControllableEntity.h"
41
42namespace orxonox
43{
44
45    /**
46    @brief
47        The JumpFigure class manages the bats for @ref orxonox::Jump "Jump", which are the elements controlled by the players.
48
49        It is responsible for the movement (controlled by the players) of the bat.
50
51    @author
52        Fabian 'x3n' Landau
53
54    @ingroup Jump
55    */
56    class _JumpExport JumpFigure : public ControllableEntity
57    {
58        public:
59            JumpFigure(Context* context); //!< Constructor. Registers and initializes the object.
60            virtual ~JumpFigure() {}
61
62            virtual void XMLPort(Element& xmlelement, XMLPort::Mode mode);
63
64            virtual void tick(float dt);
65
66            virtual void moveFrontBack(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
67            virtual void moveRightLeft(const Vector2& value); //!< Overloaded the function to steer the bat up and down.
68
69            virtual void rotateYaw(const Vector2& value);
70            virtual void rotatePitch(const Vector2& value);
71            virtual void rotateRoll(const Vector2& value);
72
73            virtual void fired(unsigned int firemode);
74
75            virtual void JumpFromPlatform(JumpPlatform* platform);
76
77            /**
78            @brief Set the height of the playing field.
79            @param height The height of the playing field.
80            */
81            void setFieldDimension(float width, float height)
82                { this->fieldWidth_ = width; this->fieldHeight_ = height; }
83
84            void setFieldDimension(const Vector2& dimension)
85                { this->setFieldDimension(dimension.x, dimension.y); }
86
87            void setMouseFactor(const float mouseFactor)
88                { this->mouseFactor_ = mouseFactor; }
89
90            const float getMouseFactor() const
91                { return this->mouseFactor_; }
92
93            /**
94            @brief Get the height of the playing field.
95            @return Returns the height of the playing field.
96            */
97            Vector2 getFieldDimension() const
98                { return Vector2(this->fieldWidth_, this->fieldHeight_); }
99
100            /**
101            @brief Set the length of the bat.
102            @param length The length of the bat (in z-direction) as percentage of the height of the playing field.
103            */
104            void setLength(float length)
105                { this->length_ = length; }
106            /**
107            @brief Get the length of the bat.
108            @return Returns the length of the bat (in z-direction) as percentage of the height of the playing field.
109            */
110            float getLength() const
111                { return this->length_; }
112
113            bool fireSignal;
114        private:
115            float movement_; //!< The amount (and direction), in z-direction, of movement of the bat.
116            bool bMoveLocal_; //!< Helper to know whether the movement is caused by moveFrontBack() or moveRightLeft().
117            float length_; //!< The length of the bat (in z-direction) as percentage of the height of the playing field.
118            float fieldWidth_; //!< The height of the playing field.
119            float fieldHeight_;
120            bool bSteadiedPosition_; //!< Helper boolean, to keep track of when to steady the position, to ensure network synchronicity.
121            float timeSinceLastFire;
122
123            bool moveUpPressed;
124            bool moveDownPressed;
125            bool moveLeftPressed;
126            bool moveRightPressed;
127            bool firePressed;
128
129            float gravityAcceleration;
130            float mouseFactor_;
131            float maxFireRate;
132
133            float horizontalSpeed;
134    };
135}
136
137#endif /* _JumpFigure_H__ */
Note: See TracBrowser for help on using the repository browser.