Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/TowerDefense_HS18/src/modules/towerdefense/TowerDefense.h @ 12125

Last change on this file since 12125 was 12125, checked in by michbaum, 5 years ago

Neuer Gegnercontroller und alle noetigen Aenderungen

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