[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 | |
---|
[8104] | 29 | /** |
---|
| 30 | @file PongBall.h |
---|
| 31 | @brief Declaration of the PongBall class. |
---|
| 32 | @ingroup Pong |
---|
| 33 | */ |
---|
| 34 | |
---|
[2825] | 35 | #ifndef _PongBall_H__ |
---|
| 36 | #define _PongBall_H__ |
---|
| 37 | |
---|
[5725] | 38 | #include "pong/PongPrereqs.h" |
---|
[2825] | 39 | |
---|
[3196] | 40 | #include "util/Math.h" |
---|
[8104] | 41 | |
---|
[5735] | 42 | #include "worldentities/MovableEntity.h" |
---|
[2825] | 43 | |
---|
| 44 | namespace orxonox |
---|
| 45 | { |
---|
[8104] | 46 | |
---|
| 47 | /** |
---|
| 48 | @brief |
---|
| 49 | This class manages the ball for Pong. |
---|
| 50 | |
---|
| 51 | //TODO: Describe what it's responnsibilities are. |
---|
| 52 | Only moves in x-z area. |
---|
| 53 | |
---|
| 54 | @author |
---|
| 55 | Fabian 'x3n' Landau |
---|
| 56 | |
---|
| 57 | @ingroup Pong |
---|
| 58 | */ |
---|
[5725] | 59 | class _PongExport PongBall : public MovableEntity |
---|
[2825] | 60 | { |
---|
| 61 | public: |
---|
| 62 | PongBall(BaseObject* creator); |
---|
[5929] | 63 | virtual ~PongBall(); |
---|
[2825] | 64 | |
---|
| 65 | virtual void tick(float dt); |
---|
[3108] | 66 | |
---|
[2825] | 67 | void setFieldDimension(float width, float height) |
---|
| 68 | { this->fieldWidth_ = width; this->fieldHeight_ = height; } |
---|
| 69 | void setFieldDimension(const Vector2& dimension) |
---|
| 70 | { this->setFieldDimension(dimension.x, dimension.y); } |
---|
[2839] | 71 | Vector2 getFieldDimension() const |
---|
| 72 | { return Vector2(this->fieldWidth_, this->fieldHeight_); } |
---|
[2825] | 73 | |
---|
| 74 | void setSpeed(float speed); |
---|
| 75 | float getSpeed() const |
---|
| 76 | { return this->speed_; } |
---|
| 77 | |
---|
[5929] | 78 | void setAccelerationFactor(float factor) |
---|
| 79 | { this->accelerationFactor_ = factor; } |
---|
| 80 | float getAccelerationFactor() const |
---|
| 81 | { return this->accelerationFactor_; } |
---|
| 82 | |
---|
[2825] | 83 | void setBatLength(float batlength) |
---|
| 84 | { this->batlength_ = batlength; } |
---|
| 85 | float getBatLength() const |
---|
| 86 | { return this->batlength_; } |
---|
| 87 | |
---|
[7852] | 88 | void setBats(WeakPtr<PongBat>* bats); |
---|
[3196] | 89 | void applyBats(); |
---|
[3108] | 90 | |
---|
[2885] | 91 | static const float MAX_REL_Z_VELOCITY; |
---|
| 92 | |
---|
[2825] | 93 | private: |
---|
[7163] | 94 | void registerVariables(); |
---|
| 95 | |
---|
[2825] | 96 | float fieldWidth_; |
---|
| 97 | float fieldHeight_; |
---|
| 98 | float speed_; |
---|
[5929] | 99 | float accelerationFactor_; |
---|
[2825] | 100 | float batlength_; |
---|
[7852] | 101 | WeakPtr<PongBat>* bat_; |
---|
[7885] | 102 | bool bDeleteBats_; |
---|
[3084] | 103 | unsigned int* batID_; |
---|
[2839] | 104 | float relMercyOffset_; |
---|
[2825] | 105 | }; |
---|
| 106 | } |
---|
| 107 | |
---|
| 108 | #endif /* _PongBall_H__ */ |
---|