| [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 |  | 
|---|
 | 29 |  | 
|---|
| [9112] | 30 | #ifndef _TowerDefense_H__ | 
|---|
 | 31 | #define _TowerDefense_H__ | 
|---|
| [10258] | 32 | #include "TDCoordinate.h" | 
|---|
| [10622] | 33 | #include "TowerDefenseSelecter.h" | 
|---|
| [9112] | 34 | #include "towerdefense/TowerDefensePrereqs.h" | 
|---|
| [10622] | 35 | #include "gametypes/TeamDeathmatch.h" | 
|---|
| [10258] | 36 | #include "TowerDefenseEnemy.h" | 
|---|
 | 37 | #include "util/Output.h" | 
|---|
| [10629] | 38 | #include "TowerDefenseField.h" | 
|---|
| [9272] | 39 |  | 
|---|
| [9112] | 40 | namespace orxonox | 
|---|
 | 41 | { | 
|---|
| [11099] | 42 |     /** | 
|---|
 | 43 |     @brief | 
|---|
 | 44 |     GameType class for TowerDefense. See TowerDefenseReadme.txt for Information. | 
|---|
 | 45 |  | 
|---|
 | 46 |     @ingroup TowerDefense | 
|---|
 | 47 |     */ | 
|---|
| [10622] | 48 |     class _TowerDefenseExport TowerDefense : public TeamDeathmatch | 
|---|
| [9112] | 49 |     { | 
|---|
| [9272] | 50 |     public: | 
|---|
| [9667] | 51 |         TowerDefense(Context* context); | 
|---|
| [10629] | 52 |         virtual ~TowerDefense();         | 
|---|
 | 53 |         void addTowerDefenseEnemy(int templatenr); | 
|---|
| [11071] | 54 |         virtual void start() override; //<! The function is called when the gametype starts | 
|---|
 | 55 |         virtual void end() override; | 
|---|
 | 56 |         virtual void tick(float dt) override; | 
|---|
 | 57 |         virtual void spawnPlayer(PlayerInfo* player) override; | 
|---|
| [10622] | 58 |         PlayerInfo* getPlayer(void) const; | 
|---|
| [10258] | 59 |         int getCredit(){ return this->credit_; } | 
|---|
| [10629] | 60 |         void payCredit(int pay){ this->credit_ -= pay; } | 
|---|
| [10258] | 61 |         int getLifes(){ return this->lifes_; } | 
|---|
| [10629] | 62 |         int getWaveNumber(){ return this->waveNumber_; } | 
|---|
 | 63 |         void setWaveNumber(int wavenumber){ waveNumber_=wavenumber; } | 
|---|
| [10258] | 64 |         void setCredit(int credit){ credit_ = credit; } | 
|---|
| [10629] | 65 |         void setLifes(int lifes){ lifes_ = lifes; }         | 
|---|
 | 66 |         void buyTower(int cost){ cost -= cost;} | 
|---|
| [10258] | 67 |         void addCredit(int credit) { credit_+=credit; } | 
|---|
 | 68 |         int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; } | 
|---|
| [10629] | 69 |         TowerDefenseField* getField(TDCoordinate* coord){ return fields_[coord->GetX()][coord->GetY()]; } | 
|---|
 | 70 |         void setCenterpoint(TowerDefenseCenterpoint* centerpoint);         | 
|---|
| [9272] | 71 |         void addTower(int x, int y); | 
|---|
| [10629] | 72 |         void upgradeTower(int x, int y);  | 
|---|
 | 73 |         virtual TDCoordinate* getNextStreetCoord(TDCoordinate*); | 
|---|
 | 74 |          | 
|---|
 | 75 |         TowerDefenseSelecter* selecter;         | 
|---|
| [9272] | 76 |  | 
|---|
| [10629] | 77 |     private: | 
|---|
 | 78 |         void createFields(); | 
|---|
| [9272] | 79 |  | 
|---|
| [10629] | 80 |         orxonox::WeakPtr<TowerDefenseCenterpoint> center_; | 
|---|
| [10622] | 81 |         PlayerInfo* player_; | 
|---|
| [10629] | 82 |         float timeSinceLastSpawn_; | 
|---|
 | 83 |         float timeUntilNextWave_; | 
|---|
 | 84 |         int waveSize_; | 
|---|
| [10258] | 85 |         int credit_; | 
|---|
| [10629] | 86 |         int waveNumber_; | 
|---|
| [10258] | 87 |         int lifes_; | 
|---|
| [11071] | 88 |         std::list<orxonox::WeakPtr<TowerDefenseEnemy>> enemies_; | 
|---|
| [10629] | 89 |         TowerDefenseField* fields_[16][16]; | 
|---|
| [11071] | 90 |         std::vector<orxonox::WeakPtr<TowerDefenseField>> waypoints_; | 
|---|
| [10629] | 91 |         Vector3 endpoint_; | 
|---|
 | 92 |         Vector3 offset_;         | 
|---|
| [9112] | 93 |     }; | 
|---|
 | 94 | } | 
|---|
 | 95 |  | 
|---|
 | 96 | #endif /* _TowerDefense_H__ */ | 
|---|