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