[9098] | 1 | /* |
---|
[9112] | 2 | * ORXONOX - the hottest 3D action shooter ever to exist |
---|
| 3 | * > www.orxonox.net < |
---|
[9098] | 4 | * |
---|
[9112] | 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 | * |
---|
| 24 | * Co-authors: |
---|
| 25 | * ... |
---|
| 26 | * |
---|
[9098] | 27 | */ |
---|
[9272] | 28 | |
---|
[9141] | 29 | /** |
---|
[9272] | 30 | @brief |
---|
| 31 | GameType class for TowerDefense. See TowerDefenseReadme.txt for Information. |
---|
| 32 | |
---|
| 33 | @ingroup TowerDefense |
---|
[9141] | 34 | */ |
---|
[9098] | 35 | |
---|
[9272] | 36 | |
---|
[9112] | 37 | #ifndef _TowerDefense_H__ |
---|
| 38 | #define _TowerDefense_H__ |
---|
[10258] | 39 | #include "TDCoordinate.h" |
---|
[10452] | 40 | #include "TowerDefenseSelecter.h" |
---|
[9112] | 41 | #include "towerdefense/TowerDefensePrereqs.h" |
---|
[10452] | 42 | #include "gametypes/TeamDeathmatch.h" |
---|
[10258] | 43 | #include "TowerDefenseEnemy.h" |
---|
| 44 | #include "util/Output.h" |
---|
| 45 | #include "core/object/WeakPtr.h" |
---|
[10452] | 46 | #include "TowerDefenseSelecter.h" |
---|
| 47 | #include "graphics/Camera.h" |
---|
[9272] | 48 | |
---|
[10452] | 49 | |
---|
[9112] | 50 | namespace orxonox |
---|
| 51 | { |
---|
[10452] | 52 | class _TowerDefenseExport TowerDefense : public TeamDeathmatch |
---|
[9112] | 53 | { |
---|
[9272] | 54 | public: |
---|
[9667] | 55 | TowerDefense(Context* context); |
---|
[9272] | 56 | virtual ~TowerDefense(); |
---|
[9143] | 57 | |
---|
[10258] | 58 | std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector; |
---|
[10452] | 59 | Model* towerModelMatrix[16][16]; |
---|
| 60 | TowerDefenseTower* towerTurretMatrix[16][16]; |
---|
[10258] | 61 | void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr); |
---|
[9272] | 62 | virtual void start(); //<! The function is called when the gametype starts |
---|
| 63 | virtual void end(); |
---|
| 64 | virtual void tick(float dt); |
---|
[10452] | 65 | virtual void spawnPlayer(PlayerInfo* player); |
---|
| 66 | PlayerInfo* getPlayer(void) const; |
---|
[10258] | 67 | int getCredit(){ return this->credit_; } |
---|
| 68 | int getLifes(){ return this->lifes_; } |
---|
| 69 | int getWaveNumber(){ return this->waves_; } |
---|
| 70 | void setCredit(int credit){ credit_ = credit; } |
---|
| 71 | void setLifes(int lifes){ lifes_ = lifes; } |
---|
| 72 | void setWaveNumber(int wavenumber){ waves_=wavenumber; } |
---|
| 73 | void buyTower(int cost){ credit_ -= cost;} |
---|
| 74 | void addCredit(int credit) { credit_+=credit; } |
---|
[10452] | 75 | void nextwave(); |
---|
[10258] | 76 | int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } |
---|
[10452] | 77 | TowerDefenseSelecter* selecter; |
---|
| 78 | int spaceships; |
---|
| 79 | int eggs; |
---|
| 80 | int ufos; |
---|
| 81 | int randomships; |
---|
[9143] | 82 | |
---|
[10452] | 83 | |
---|
[9272] | 84 | //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); |
---|
[9347] | 85 | //virtual void playerScored(PlayerInfo* player, int score); |
---|
[9272] | 86 | |
---|
| 87 | |
---|
| 88 | /* Called by TowerDefenseCenterpoint upon game start |
---|
| 89 | The centerpoint is used to create towers |
---|
| 90 | */ |
---|
| 91 | void setCenterpoint(TowerDefenseCenterpoint *centerpoint); |
---|
| 92 | |
---|
| 93 | /* Adds a tower at x, y in the playfield */ |
---|
| 94 | void addTower(int x, int y); |
---|
[10258] | 95 | void upgradeTower(int x, int y); |
---|
[9272] | 96 | |
---|
| 97 | //TODO: void spawnNewWave() |
---|
| 98 | //TODO: create a timer which regularly calls the spawnNewWave function (time driven) |
---|
| 99 | // or spawn a new wave when the old wave has been killed (event driven) |
---|
| 100 | |
---|
| 101 | |
---|
| 102 | private: |
---|
| 103 | TowerDefenseCenterpoint *center_; |
---|
[10452] | 104 | PlayerInfo* player_; |
---|
[10258] | 105 | float time; |
---|
[10452] | 106 | float timeSetTower_; |
---|
| 107 | // float time2; |
---|
[10258] | 108 | int credit_; |
---|
| 109 | int waves_; |
---|
| 110 | int lifes_; |
---|
[10452] | 111 | Timer nextwaveTimer_; |
---|
[9272] | 112 | |
---|
| 113 | /* handles stats */ |
---|
[10258] | 114 | bool hasEnoughCreditForTower(int towerCost); |
---|
| 115 | bool hasEnoughCreditForUpgrade(); |
---|
[9112] | 116 | }; |
---|
| 117 | } |
---|
| 118 | |
---|
| 119 | #endif /* _TowerDefense_H__ */ |
---|