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 Pong.h |
---|
31 | @brief Declaration of the Pong class. |
---|
32 | @ingroup Pong |
---|
33 | */ |
---|
34 | |
---|
35 | #ifndef _Pong_H__ |
---|
36 | #define _Pong_H__ |
---|
37 | |
---|
38 | #include "pong/PongPrereqs.h" |
---|
39 | |
---|
40 | #include "tools/Timer.h" |
---|
41 | |
---|
42 | #include "gametypes/Deathmatch.h" |
---|
43 | |
---|
44 | namespace orxonox |
---|
45 | { |
---|
46 | |
---|
47 | /** |
---|
48 | @brief |
---|
49 | Implements a Pong minigame. |
---|
50 | It connects the different entities present in a game of Pong. |
---|
51 | |
---|
52 | //TODO: List and add details to different classes used and how. |
---|
53 | PongBall, is the ball, PongBats are the things that can be moved by the players (ControllableEntities), PongCenterpoint is the playing field. (x-z area) |
---|
54 | |
---|
55 | @author |
---|
56 | Fabian 'x3n' Landau |
---|
57 | |
---|
58 | @ingroup Pong |
---|
59 | */ |
---|
60 | class _PongExport Pong : public Deathmatch |
---|
61 | { |
---|
62 | public: |
---|
63 | Pong(BaseObject* creator); //!< Constructor. Registers and initializes the object. |
---|
64 | virtual ~Pong(); //!< Destructor. Cleans up, if initialized. |
---|
65 | |
---|
66 | virtual void start(); //!< Starts the Pong minigame. |
---|
67 | virtual void end(); ///!< Ends the Pong minigame. |
---|
68 | |
---|
69 | virtual void spawnPlayer(PlayerInfo* player); //!< Spawns the input player. |
---|
70 | |
---|
71 | virtual void playerScored(PlayerInfo* player); //!< Is called when the player scored. |
---|
72 | |
---|
73 | /** |
---|
74 | @brief Set the PongCenterpoint (the playing field). |
---|
75 | @param center A pointer to the PongCenterpoint to be set. |
---|
76 | */ |
---|
77 | void setCenterpoint(PongCenterpoint* center) |
---|
78 | { this->center_ = center; } |
---|
79 | |
---|
80 | PlayerInfo* getLeftPlayer() const; //!< Get the left player. |
---|
81 | PlayerInfo* getRightPlayer() const; //!< Get the right player. |
---|
82 | |
---|
83 | protected: |
---|
84 | virtual void spawnPlayersIfRequested(); //!< Spawns players, and fills the rest up with bots. |
---|
85 | |
---|
86 | void startBall(); //!< Starts the ball with some default speed. |
---|
87 | void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats. |
---|
88 | |
---|
89 | WeakPtr<PongCenterpoint> center_; //!< The playing field. |
---|
90 | WeakPtr<PongBall> ball_; //!< The Pong ball. |
---|
91 | WeakPtr<PongBat> bat_[2]; //!< The two bats. |
---|
92 | Timer starttimer_; //!< A timer to delay the start of the game. |
---|
93 | }; |
---|
94 | } |
---|
95 | |
---|
96 | #endif /* _Pong_H__ */ |
---|