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