| 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 "gametypes/Deathmatch.h" |
|---|
| 46 | #include "tools/Timer.h" |
|---|
| 47 | |
|---|
| 48 | namespace orxonox |
|---|
| 49 | { |
|---|
| 50 | |
|---|
| 51 | class _Asteroids2DExport Asteroids2D : public Deathmatch |
|---|
| 52 | { |
|---|
| 53 | public: |
|---|
| 54 | Asteroids2D(Context* context); |
|---|
| 55 | |
|---|
| 56 | virtual void start() override; |
|---|
| 57 | virtual void end() override; |
|---|
| 58 | |
|---|
| 59 | //updates the game every few ns |
|---|
| 60 | virtual void tick(float dt) override; |
|---|
| 61 | |
|---|
| 62 | virtual void playerPreSpawn(PlayerInfo* player) override; |
|---|
| 63 | |
|---|
| 64 | void levelUp(); |
|---|
| 65 | |
|---|
| 66 | |
|---|
| 67 | //For HUD |
|---|
| 68 | int getLives(){return this->lives;} |
|---|
| 69 | int getLevel(){return this->level;} |
|---|
| 70 | int getPoints(){return this->point;} |
|---|
| 71 | int getMultiplier(){return this->multiplier;} |
|---|
| 72 | |
|---|
| 73 | //Generate Stones |
|---|
| 74 | void spawnStone(); |
|---|
| 75 | void setCenterpoint(Asteroids2DCenterPoint* center); |
|---|
| 76 | |
|---|
| 77 | void addPoints(int numPoints); |
|---|
| 78 | virtual void addBots(unsigned int amount) override{} //<! overwrite function in order to bypass the addbots command |
|---|
| 79 | |
|---|
| 80 | // checks if multiplier should be reset. |
|---|
| 81 | void costLife(); |
|---|
| 82 | |
|---|
| 83 | //Returns player (ship) of the game |
|---|
| 84 | Asteroids2DShip* getPlayer(); |
|---|
| 85 | |
|---|
| 86 | bool bEndGame; |
|---|
| 87 | bool bShowLevel; |
|---|
| 88 | int lives; |
|---|
| 89 | int multiplier; |
|---|
| 90 | |
|---|
| 91 | |
|---|
| 92 | private: |
|---|
| 93 | |
|---|
| 94 | |
|---|
| 95 | |
|---|
| 96 | WeakPtr<PlayerInfo> playerInfo_; |
|---|
| 97 | void toggleShowLevel(){bShowLevel = !bShowLevel;} |
|---|
| 98 | |
|---|
| 99 | WeakPtr<Asteroids2DCenterPoint> center_; |
|---|
| 100 | int level; |
|---|
| 101 | int point; |
|---|
| 102 | bool b_combo, firstTick_; |
|---|
| 103 | |
|---|
| 104 | Timer comboTimer; |
|---|
| 105 | Timer showLevelTimer; |
|---|
| 106 | Timer levelupTimer; |
|---|
| 107 | Timer endGameTimer; |
|---|
| 108 | |
|---|
| 109 | |
|---|
| 110 | }; |
|---|
| 111 | } |
|---|
| 112 | |
|---|
| 113 | #endif /* _Asteroids2D_H__ */ |
|---|