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 | * Viviane Yang |
---|
24 | * Co-authors: |
---|
25 | * ... |
---|
26 | * |
---|
27 | */ |
---|
28 | |
---|
29 | |
---|
30 | |
---|
31 | /** |
---|
32 | @file Asteroids2D.h |
---|
33 | @brief Gametype: |
---|
34 | - Goal: Survive as long as you can, do not collide with stones |
---|
35 | - spawns stones in every level up |
---|
36 | - if you shoot and hit a stone, it will spit into two smaller stones |
---|
37 | @ingroup Asteroids2D |
---|
38 | */ |
---|
39 | |
---|
40 | #ifndef _Asteroids2D_H__ |
---|
41 | #define _Asteroids2D_H__ |
---|
42 | |
---|
43 | #include "asteroids2D/Asteroids2DPrereqs.h" |
---|
44 | |
---|
45 | #include "Asteroids2DCenterPoint.h" // Necessary for WeakPointer?? |
---|
46 | //#include "Asteroids2DShip.h" DO NOT include in Header. Will cause forward declaration issues |
---|
47 | |
---|
48 | //#include "Asteroids2DHUDinfo.h" |
---|
49 | |
---|
50 | |
---|
51 | #include "core/EventIncludes.h" |
---|
52 | #include "core/command/Executor.h" |
---|
53 | #include "core/config/ConfigValueIncludes.h" |
---|
54 | |
---|
55 | #include "gamestates/GSLevel.h" |
---|
56 | #include "chat/ChatManager.h" |
---|
57 | |
---|
58 | // ! HACK |
---|
59 | #include "infos/PlayerInfo.h" |
---|
60 | |
---|
61 | #include "core/command/ConsoleCommand.h" |
---|
62 | |
---|
63 | #include "gametypes/Deathmatch.h" |
---|
64 | #include "tools/Timer.h" |
---|
65 | |
---|
66 | namespace orxonox |
---|
67 | { |
---|
68 | |
---|
69 | class _Asteroids2DExport Asteroids2D : public Deathmatch |
---|
70 | { |
---|
71 | public: |
---|
72 | Asteroids2D(Context* context); |
---|
73 | |
---|
74 | virtual void start() override; |
---|
75 | virtual void end() override; |
---|
76 | |
---|
77 | //updates the game every few ns |
---|
78 | virtual void tick(float dt) override; |
---|
79 | |
---|
80 | virtual void playerPreSpawn(PlayerInfo* player) override; |
---|
81 | |
---|
82 | void levelUp(); |
---|
83 | |
---|
84 | |
---|
85 | //For HUD |
---|
86 | int getLives(){return this->lives;} |
---|
87 | int getLevel(){return this->level;} |
---|
88 | int getPoints(){return this->point;} |
---|
89 | int getMultiplier(){return this->multiplier;} |
---|
90 | |
---|
91 | //Generate Stones |
---|
92 | void spawnStone(); |
---|
93 | void setCenterpoint(Asteroids2DCenterPoint* center) |
---|
94 | { this->center_ = center; } |
---|
95 | void addPoints(int numPoints); |
---|
96 | virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command |
---|
97 | |
---|
98 | // checks if multiplier should be reset. |
---|
99 | void costLife(); |
---|
100 | |
---|
101 | //Returns player (ship) of the game |
---|
102 | Asteroids2DShip* getPlayer(); |
---|
103 | |
---|
104 | bool bEndGame; |
---|
105 | bool bShowLevel; |
---|
106 | int lives; |
---|
107 | int multiplier; |
---|
108 | |
---|
109 | |
---|
110 | private: |
---|
111 | |
---|
112 | |
---|
113 | |
---|
114 | WeakPtr<Asteroids2DShip> player; |
---|
115 | void toggleShowLevel(){bShowLevel = !bShowLevel;} |
---|
116 | |
---|
117 | WeakPtr<Asteroids2DCenterPoint> center_; |
---|
118 | int level; |
---|
119 | int point; |
---|
120 | bool b_combo, firstTick_; |
---|
121 | |
---|
122 | Timer comboTimer; |
---|
123 | Timer showLevelTimer; |
---|
124 | Timer levelupTimer; |
---|
125 | Timer endGameTimer; |
---|
126 | |
---|
127 | |
---|
128 | }; |
---|
129 | } |
---|
130 | |
---|
131 | #endif /* _Asteroids2D_H__ */ |
---|