Orxonox  0.0.5 Codename: Arcturus
TowerDefense.h
Go to the documentation of this file.
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"
36 #include "TowerDefenseEnemy.h"
37 #include "util/Output.h"
38 #include "TowerDefenseField.h"
39 
40 namespace orxonox
41 {
49  {
50  public:
51  TowerDefense(Context* context);
52  virtual ~TowerDefense();
53  void addTowerDefenseEnemy(int templatenr);
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;
58  PlayerInfo* getPlayer(void) const;
59  int getCredit(){ return this->credit_; }
60  void payCredit(int pay){ this->credit_ -= pay; }
61  int getLifes(){ return this->lifes_; }
62  int getWaveNumber(){ return this->waveNumber_; }
63  void setWaveNumber(int wavenumber){ waveNumber_=wavenumber; }
64  void setCredit(int credit){ credit_ = credit; }
65  void setLifes(int lifes){ lifes_ = lifes; }
66  void buyTower(int cost){ cost -= cost;}
67  void addCredit(int credit) { credit_+=credit; }
68  int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
69  TowerDefenseField* getField(TDCoordinate* coord){ return fields_[coord->GetX()][coord->GetY()]; }
70  void setCenterpoint(TowerDefenseCenterpoint* centerpoint);
71  void addTower(int x, int y);
72  void upgradeTower(int x, int y);
73  virtual TDCoordinate* getNextStreetCoord(TDCoordinate*);
74 
76 
77  private:
78  void createFields();
79 
84  int waveSize_;
85  int credit_;
87  int lifes_;
88  std::list<orxonox::WeakPtr<TowerDefenseEnemy>> enemies_;
89  TowerDefenseField* fields_[16][16];
90  std::vector<orxonox::WeakPtr<TowerDefenseField>> waypoints_;
91  Vector3 endpoint_;
92  Vector3 offset_;
93  };
94 }
95 
96 #endif /* _TowerDefense_H__ */
float timeUntilNextWave_
Definition: TowerDefense.h:83
int reduceLifes(int NumberofLifes)
Definition: TowerDefense.h:68
void buyTower(int cost)
Definition: TowerDefense.h:66
int getWaveNumber()
Definition: TowerDefense.h:62
Shared library macros, enums, constants and forward declarations for the TowerDefense module ...
Vector3 offset_
Definition: TowerDefense.h:92
TowerDefenseField * getField(TDCoordinate *coord)
Definition: TowerDefense.h:69
std::vector< orxonox::WeakPtr< TowerDefenseField > > waypoints_
Definition: TowerDefense.h:90
Definition: TDCoordinate.h:15
Vector3 endpoint_
Definition: TowerDefense.h:91
See TowerDefenseReadme.txt for Information.
Definition: TowerDefenseField.h:58
WeakPtr wraps a pointer to an object, which becomes nullptr if the object is deleted.
Definition: CorePrereqs.h:236
int waveNumber_
Definition: TowerDefense.h:86
int getCredit()
Definition: TowerDefense.h:59
void setWaveNumber(int wavenumber)
Definition: TowerDefense.h:63
TowerDefenseSelecter * selecter
Definition: TowerDefense.h:75
float timeSinceLastSpawn_
Definition: TowerDefense.h:82
orxonox::WeakPtr< TowerDefenseCenterpoint > center_
Definition: TowerDefense.h:80
Definition: TowerDefenseSelecter.h:38
PlayerInfo * player_
Definition: TowerDefense.h:81
virtual int GetY()
Definition: TDCoordinate.cc:58
Die Wagnis Klasse hat die folgenden Aufgaben:
Definition: ApplicationPaths.cc:66
int getLifes()
Definition: TowerDefense.h:61
Definition: TeamDeathmatch.h:37
Defines the helper function orxout() and includes all necessary headers to use the output system...
Definition: Context.h:45
std::list< orxonox::WeakPtr< TowerDefenseEnemy > > enemies_
Definition: TowerDefense.h:88
int credit_
Definition: TowerDefense.h:85
#define _TowerDefenseExport
Definition: TowerDefensePrereqs.h:58
void payCredit(int pay)
Definition: TowerDefense.h:60
virtual int GetX()
Definition: TDCoordinate.cc:53
int waveSize_
Definition: TowerDefense.h:84
int lifes_
Definition: TowerDefense.h:87
Definition: PlayerInfo.h:39
void addCredit(int credit)
Definition: TowerDefense.h:67
void setLifes(int lifes)
Definition: TowerDefense.h:65
void setCredit(int credit)
Definition: TowerDefense.h:64
See TowerDefenseReadme.txt for Information.
Definition: TowerDefenseCenterpoint.h:47
GameType class for TowerDefense.
Definition: TowerDefense.h:48