Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/OrxoBlox_FS19/src/modules/OrxoBlox/OrxoBlox.h @ 12308

Last change on this file since 12308 was 12308, checked in by ahuwyler, 5 years ago

Bats are gone

File size: 4.8 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 OrxoBlox.h
31    @brief Declaration of the OrxoBlox class.
32    @ingroup OrxoBlox
33*/
34
35#ifndef _OrxoBlox_H__
36#define _OrxoBlox_H__
37
38#include "OrxoBlox/OrxoBloxPrereqs.h"
39
40#include "tools/Timer.h"
41
42#include "gametypes/Deathmatch.h"
43#include "OrxoBloxCenterpoint.h"
44#include "OrxoBloxWall.h"
45
46namespace orxonox
47{
48
49    /**
50    @brief
51        Implements a OrxoBlox minigame (<a href="http://en.wikipedia.org/wiki/OrxoBlox">Wikipedia::OrxoBlox</a>).
52        It connects the different entities present in a game of OrxoBlox.
53
54        - 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 />
55        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 />
56        The @ref orxonox::OrxoBloxCenterpoint "OrxoBloxCenterpoint" needs to exist in a level with the @ref orxonox::Gametype "Gametype" <em>OrxoBlox</em>.
57        - 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).
58        - 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.
59
60    @author
61        Fabian 'x3n' Landau
62
63    @ingroup OrxoBlox
64    */
65    class _OrxoBloxExport OrxoBlox : public Deathmatch
66    {
67        public:
68            OrxoBlox(Context* context); //!< Constructor. Registers and initializes the object.
69            virtual ~OrxoBlox(); //!< Destructor. Cleans up, if initialized.
70
71            virtual void start() override; //!< Starts the OrxoBlox minigame.
72            virtual void end() override; ///!< Ends the OrxoBlox minigame.
73
74            virtual void spawnPlayer(PlayerInfo* player) override; //!< Spawns the input player.
75
76           
77
78            /**
79            @brief Set the OrxoBloxCenterpoint (the playing field).
80            @param center A pointer to the OrxoBloxCenterpoint to be set.
81            */
82            void setCenterpoint(OrxoBloxCenterpoint* center)
83                { this->center_ = center; }
84
85            OrxoBloxCenterpoint* getCenterpoint(void)
86                { return this->center_; }
87
88        protected:
89            virtual void spawnPlayersIfRequested() override; //!< Spawns players, and fills the rest up with bots.
90        private:
91            void startWall(void);
92            void createWall(void);
93            void startBall(); //!< Starts the ball with some default speed.
94            void cleanup(); //!< Cleans up the Gametype by destroying the ball and the bats.
95
96            WeakPtr<OrxoBloxCenterpoint> center_; //!< The playing field.
97            WeakPtr<OrxoBloxBall> ball_; //!< The OrxoBlox ball.
98           
99            PlayerInfo* player_;
100
101            Timer starttimer_; //!< A timer to delay the start of the game.
102           
103            WeakPtr<OrxoBloxWall> futureWall_;
104            WeakPtr<OrxoBloxWall> activeWalls_[6]; //6 is the number of wallls in the game.
105    };
106}
107
108#endif /* _OrxoBlox_H__ */
Note: See TracBrowser for help on using the repository browser.