[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__ |
---|
[10248] | 39 | #include "TDCoordinate.h" |
---|
[9112] | 40 | #include "towerdefense/TowerDefensePrereqs.h" |
---|
| 41 | #include "gametypes/Deathmatch.h" |
---|
[10248] | 42 | #include "TowerDefenseEnemy.h" |
---|
| 43 | #include "util/Output.h" |
---|
| 44 | #include "core/object/WeakPtr.h" |
---|
[9272] | 45 | |
---|
[9112] | 46 | namespace orxonox |
---|
| 47 | { |
---|
[9272] | 48 | class _TowerDefenseExport TowerDefense : public Deathmatch |
---|
[9112] | 49 | { |
---|
[9272] | 50 | public: |
---|
[9667] | 51 | TowerDefense(Context* context); |
---|
[9272] | 52 | virtual ~TowerDefense(); |
---|
[9143] | 53 | |
---|
[10248] | 54 | std::vector<orxonox::WeakPtr<TowerDefenseEnemy> > TowerDefenseEnemyvector; |
---|
| 55 | bool towermatrix[16][16]; |
---|
| 56 | void addTowerDefenseEnemy(std::vector<TDCoordinate*> path, int templatenr); |
---|
[9272] | 57 | virtual void start(); //<! The function is called when the gametype starts |
---|
| 58 | virtual void end(); |
---|
| 59 | virtual void tick(float dt); |
---|
| 60 | //virtual void playerEntered(PlayerInfo* player); |
---|
| 61 | //virtual bool playerLeft(PlayerInfo* player); |
---|
[10248] | 62 | //Player Stats (set,get, reduce) |
---|
| 63 | int getCredit(){ return this->credit_; } |
---|
| 64 | int getLifes(){ return this->lifes_; } |
---|
| 65 | int getWaveNumber(){ return this->waves_; } |
---|
| 66 | void setCredit(int credit){ credit_ = credit; } |
---|
| 67 | void setLifes(int lifes){ lifes_ = lifes; } |
---|
| 68 | void setWaveNumber(int wavenumber){ waves_=wavenumber; } |
---|
| 69 | void buyTower(int cost){ credit_ -= cost;} |
---|
| 70 | void addCredit(int credit) { credit_+=credit; } |
---|
| 71 | void nextwave(){ waves_++;} |
---|
| 72 | int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } |
---|
[9143] | 73 | |
---|
[9272] | 74 | //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0); |
---|
[9347] | 75 | //virtual void playerScored(PlayerInfo* player, int score); |
---|
[9272] | 76 | |
---|
| 77 | |
---|
| 78 | /* Called by TowerDefenseCenterpoint upon game start |
---|
| 79 | The centerpoint is used to create towers |
---|
| 80 | */ |
---|
| 81 | void setCenterpoint(TowerDefenseCenterpoint *centerpoint); |
---|
| 82 | |
---|
| 83 | /* Adds a tower at x, y in the playfield */ |
---|
| 84 | void addTower(int x, int y); |
---|
| 85 | |
---|
[10248] | 86 | void upgradeTower(int x, int y); |
---|
[9272] | 87 | /* Part of a temporary hack to allow the player to add towers */ |
---|
| 88 | ConsoleCommand* dedicatedAddTower_; |
---|
[10248] | 89 | ConsoleCommand* dedicatedUpgradeTower_; |
---|
[9272] | 90 | |
---|
| 91 | //TODO: void spawnNewWave() |
---|
| 92 | //TODO: create a timer which regularly calls the spawnNewWave function (time driven) |
---|
| 93 | // or spawn a new wave when the old wave has been killed (event driven) |
---|
| 94 | |
---|
| 95 | |
---|
| 96 | private: |
---|
| 97 | TowerDefenseCenterpoint *center_; |
---|
[10248] | 98 | float time; |
---|
| 99 | float time2; |
---|
| 100 | int credit_; |
---|
| 101 | int waves_; |
---|
| 102 | int lifes_; |
---|
[9272] | 103 | |
---|
| 104 | /* handles stats */ |
---|
[10248] | 105 | bool hasEnoughCreditForTower(int towerCost); |
---|
| 106 | bool hasEnoughCreditForUpgrade(); |
---|
[9272] | 107 | |
---|
| 108 | |
---|
| 109 | |
---|
[10248] | 110 | std::vector<TowerTurret*> towers_; |
---|
[9112] | 111 | }; |
---|
| 112 | } |
---|
| 113 | |
---|
| 114 | #endif /* _TowerDefense_H__ */ |
---|