1 | #ifndef _OrxoBlox_H__ |
---|
2 | #define _OrxoBlox_H__ |
---|
3 | |
---|
4 | #include "OrxoBlox/OrxoBloxPrereqs.h" |
---|
5 | |
---|
6 | #include "tools/Timer.h" |
---|
7 | |
---|
8 | #include "gametypes/Deathmatch.h" |
---|
9 | #include "OrxoBloxCenterpoint.h" |
---|
10 | #include "OrxoBloxWall.h" |
---|
11 | #include "OrxoBloxShip.h" |
---|
12 | |
---|
13 | namespace orxonox |
---|
14 | { |
---|
15 | |
---|
16 | /** |
---|
17 | @brief |
---|
18 | Implements a OrxoBlox minigame (<a href="http://en.wikipedia.org/wiki/OrxoBlox">Wikipedia::OrxoBlox</a>). |
---|
19 | It connects the different entities present in a game of OrxoBlox. |
---|
20 | |
---|
21 | - The @ref orxonox::OrxoBloxCenterpoint "OrxoBloxCenterpoint" is the playing field for the OrxoBlox minigame, it allows for configuration of the minigame, e.g. by setting the size of the playing field, or the length of the @ref orxonox::OrxoBloxBat "OrxoBloxBats". The playing field is always in the x,y-plane, the x-axis being the horizontal and the z-axis being the vertical axis.<br /> |
---|
22 | The OrxoBlox class redistributes the important parameters defined in @ref orxonox::OrxoBloxCenterpoint "OrxoBloxCenterpoint" to the other entities, that need to know them, e.g. the @ref orxonox::OrxoBloxBall "OrxoBloxBall" and the @ref orxonox::OrxoBloxBat "OrxoBloxBats".<br /> |
---|
23 | The @ref orxonox::OrxoBloxCenterpoint "OrxoBloxCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>OrxoBlox</em>. |
---|
24 | - The @ref orxonox::OrxoBloxBall "OrxoBloxBall" is the ball both players play with. The @ref orxonox::OrxoBloxBall "OrxoBloxBall" both implements the movement of the ball, as well as the influence of the boundaries and consequently, also the bouncing (off the upper and lower delimiters, and as off the @ref orxonox::OrxoBloxBat "OrxoBloxBats") of the ball and the effects of the failure of a player to catch the ball (i.e. the scoring of the other player). |
---|
25 | - The two @ref orxonox::OrxoBloxBat "OrxoBloxBats" are the entities through which the players can actively participate in the game, by controlling them. The @ref orxonox::OrxoBloxBat "OrxoBloxBat" class manages the movement (and restrictions thereof) and the influence of the players on the bats. |
---|
26 | |
---|
27 | @author |
---|
28 | Fabian 'x3n' Landau |
---|
29 | |
---|
30 | @ingroup OrxoBlox |
---|
31 | */ |
---|
32 | class _OrxoBloxExport OrxoBlox : public Deathmatch |
---|
33 | { |
---|
34 | public: |
---|
35 | OrxoBlox(Context* context); //!< Constructor. Registers and initializes the object. |
---|
36 | virtual ~OrxoBlox(); //!< Destructor. Cleans up, if initialized. |
---|
37 | |
---|
38 | virtual void start() override; //!< Starts the OrxoBlox minigame. |
---|
39 | virtual void end() override; ///!< Ends the OrxoBlox minigame. |
---|
40 | |
---|
41 | PlayerInfo* getPlayer(); |
---|
42 | virtual void playerPreSpawn(PlayerInfo* player) override; |
---|
43 | virtual void tick(float dt) override; |
---|
44 | |
---|
45 | void LevelUp(); |
---|
46 | |
---|
47 | /** |
---|
48 | @brief Set the OrxoBloxCenterpoint (the playing field). |
---|
49 | @param center A pointer to the OrxoBloxCenterpoint to be set. |
---|
50 | */ |
---|
51 | void setCenterpoint(OrxoBloxCenterpoint* center) |
---|
52 | { this->center_ = center; } |
---|
53 | |
---|
54 | OrxoBloxCenterpoint* getCenterpoint(void) |
---|
55 | { return this->center_; } |
---|
56 | virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command |
---|
57 | void count(); |
---|
58 | protected: |
---|
59 | private: |
---|
60 | void startWall(void); |
---|
61 | void createWall(void); |
---|
62 | void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats. |
---|
63 | |
---|
64 | WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field. |
---|
65 | unsigned int level_; |
---|
66 | |
---|
67 | WeakPtr<OrxoBloxShip> playership; |
---|
68 | PlayerInfo* player_; |
---|
69 | Timer starttimer_; //!< A timer to delay the start of the game. |
---|
70 | |
---|
71 | WeakPtr<OrxoBloxWall> futureWall_; |
---|
72 | int counter; |
---|
73 | const int max_counter = 5; |
---|
74 | |
---|
75 | }; |
---|
76 | } |
---|
77 | |
---|
78 | #endif /* _OrxoBlox_H__ */ |
---|