Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

source: code/branches/towerdefenseFabien/src/modules/towerdefense/TowerDefense.h @ 10587

Last change on this file since 10587 was 10587, checked in by landauf, 9 years ago

use list instead of vector - list is better suited for removing elements

  • Property svn:eol-style set to native
File size: 3.8 KB
RevLine 
[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
[9141]29 /**
[9272]30    @brief
31        GameType class for TowerDefense. See TowerDefenseReadme.txt for Information.
32
33    @ingroup TowerDefense
[9141]34 */
[9098]35
[9272]36
[9112]37#ifndef _TowerDefense_H__
38#define _TowerDefense_H__
[10258]39#include "TDCoordinate.h"
[10586]40#include "TowerDefenseSelecter.h"
[9112]41#include "towerdefense/TowerDefensePrereqs.h"
[10586]42#include "gametypes/TeamDeathmatch.h"
[10258]43#include "TowerDefenseEnemy.h"
44#include "util/Output.h"
[10586]45#include "TowerDefenseField.h"
[9272]46
[9112]47namespace orxonox
48{
[10586]49    class _TowerDefenseExport TowerDefense : public TeamDeathmatch
[9112]50    {
[9272]51    public:
[9667]52        TowerDefense(Context* context);
[10586]53        virtual ~TowerDefense();       
54        void addTowerDefenseEnemy(int templatenr);
[9272]55        virtual void start(); //<! The function is called when the gametype starts
56        virtual void end();
57        virtual void tick(float dt);
[10586]58        virtual void spawnPlayer(PlayerInfo* player);
59        PlayerInfo* getPlayer(void) const;
[10258]60        int getCredit(){ return this->credit_; }
[10586]61        void payCredit(int pay){ this->credit_ -= pay; }
[10258]62        int getLifes(){ return this->lifes_; }
63        int getWaveNumber(){ return this->waves_; }
64        void setCredit(int credit){ credit_ = credit; }
65        void setLifes(int lifes){ lifes_ = lifes; }
66        void setWaveNumber(int wavenumber){ waves_=wavenumber; }
67        void buyTower(int cost){ credit_ -= cost;}
68        void addCredit(int credit) { credit_+=credit; }
[10586]69        void nextwave(){ enemies_.clear(); waves_++; time=0;}
[10258]70        int reduceLifes(int NumberofLifes){ return lifes_-=NumberofLifes; }
[10586]71        TowerDefenseField* getField(TDCoordinate* coord){ return fields_[coord->GetX()][coord->GetY()]; }
[9272]72        /*  Called by TowerDefenseCenterpoint upon game start
73            The centerpoint is used to create towers
74        */
[10586]75        void setCenterpoint(TowerDefenseCenterpoint* centerpoint);       
[9272]76        /* Adds a tower at x, y in the playfield */
77        void addTower(int x, int y);
[10586]78        void upgradeTower(int x, int y); 
79        virtual TDCoordinate* getNextStreetCoord(TDCoordinate*);
[9272]80
[10586]81        //virtual void pawnKilled(Pawn* victim, Pawn* killer = 0);
82        //virtual void playerScored(PlayerInfo* player, int score);
[9272]83
[10586]84        TowerDefenseSelecter* selecter;       
85
[9272]86        //TODO: void spawnNewWave()
87        //TODO: create a timer which regularly calls the spawnNewWave function  (time driven)
88        //      or spawn a new wave when the old wave has been killed           (event driven)
89
90    private:
[10586]91        orxonox::WeakPtr<TowerDefenseCenterpoint> center_;
92        PlayerInfo* player_;
93        float time;       
[10258]94        int credit_;
95        int waves_;
96        int lifes_;
[10586]97        Timer nextwaveTimer_;
[10587]98        std::list<orxonox::WeakPtr<TowerDefenseEnemy> > enemies_;
[10586]99        TowerDefenseField* fields_[16][16];
100        std::vector<orxonox::WeakPtr<TowerDefenseField> > waypoints_;
101        Vector3 endpoint_;
[9272]102
[10586]103        void createFields();
[9112]104    };
105}
106
107#endif /* _TowerDefense_H__ */
Note: See TracBrowser for help on using the repository browser.