Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/trunk/src/modules/pong/PongBat.h @ 11540

Last change on this file since 11540 was 11071, checked in by landauf, 9 years ago

merged branch cpp11_v3 back to trunk

  • Property svn:eol-style set to native
File size: 4.2 KB
RevLine 
[2825]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
[8108]29/**
30    @file PongBat.h
31    @brief Declaration of the PongBat class.
32    @ingroup Pong
33*/
34
[2825]35#ifndef _PongBat_H__
36#define _PongBat_H__
37
[5725]38#include "pong/PongPrereqs.h"
[8108]39
[5735]40#include "worldentities/ControllableEntity.h"
[2825]41
42namespace orxonox
43{
[8108]44
45    /**
46    @brief
47        The PongBat class manages the bats for @ref orxonox::Pong "Pong", 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 Pong
55    */
[5725]56    class _PongExport PongBat : public ControllableEntity
[2825]57    {
58        public:
[9667]59            PongBat(Context* context); //!< Constructor. Registers and initializes the object.
[2825]60            virtual ~PongBat() {}
61
[11071]62            virtual void tick(float dt) override;
[2825]63
[11071]64            virtual void moveFrontBack(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down.
65            virtual void moveRightLeft(const Vector2& value) override; //!< Overloaded the function to steer the bat up and down.
[2825]66
[11071]67            virtual void changedPlayer() override; //!< Is called when the player changed.
[2839]68
[8108]69            /**
70            @brief Set the speed of the bat.
71            @param speed The speed to be set.
72            */
[2825]73            void setSpeed(float speed)
74                { this->speed_ = speed; }
[8108]75            /**
76            @brief Get the speed of the bat.
77            @return Returns the speed of the bat.
78            */
[2825]79            float getSpeed() const
80                { return this->speed_; }
81
[8108]82            /**
83            @brief Set the height of the playing field.
84            @param height The height of the playing field.
85            */
[2825]86            void setFieldHeight(float height)
87                { this->fieldHeight_ = height; }
[8108]88            /**
89            @brief Get the height of the playing field.
90            @return Returns the height of the playing field.
91            */
[2825]92            float getFieldHeight() const
93                { return this->fieldHeight_; }
94
[8108]95            /**
96            @brief Set the length of the bat.
97            @param length The length of the bat (in z-direction) as percentage of the height of the playing field.
98            */
[2825]99            void setLength(float length)
100                { this->length_ = length; }
[8108]101            /**
[8706]102            @brief Get the length of the bat.
[8108]103            @return Returns the length of the bat (in z-direction) as percentage of the height of the playing field.
104            */
[2825]105            float getLength() const
106                { return this->length_; }
107
108        private:
[8108]109            void registerVariables(); //!< Registers variables to be synchronized over the network.
[7163]110
[8108]111            float movement_; //!< The amount (and direction), in z-direction, of movement of the bat.
112            bool bMoveLocal_; //!< Helper to know whether the movement is caused by moveFrontBack() or moveRightLeft().
113            float speed_; //!< The movement speed of the bat.
114            float length_; //!< The length of the bat (in z-direction) as percentage of the height of the playing field.
115            float fieldHeight_; //!< The height of the playing field.
116            bool bSteadiedPosition_; //!< Helper boolean, to keep track of when to steady the position, to ensure network synchronicity.
[2825]117    };
118}
119
120#endif /* _PongBat_H__ */
Note: See TracBrowser for help on using the repository browser.