37 lines
990 B
C++
37 lines
990 B
C++
#ifndef TOWERS_H
|
|
#define TOWERS_H
|
|
|
|
#include "game_data.h"
|
|
|
|
class Towers : public QObject
|
|
{
|
|
Q_OBJECT
|
|
public:
|
|
explicit Towers(Game_Data * gd, QObject *parent = 0);
|
|
bool addTower(int playerId, int srcId, QPoint pos);
|
|
void delTower(QPoint pos);
|
|
bool morphTower(QPoint id, int index);
|
|
bool canBuild(int id, int player) {return gameData->players[player]->money >= gameData->players[player]->srcTowers[id].cost;}
|
|
bool canMorph(QPoint id, int index)
|
|
{
|
|
TowerType * t = &(gameData->curTowers[id]);
|
|
return gameData->players[t->PlayerId]->money >= t->src->morphs[index].cost &&
|
|
t->experience >= t->src->morphs[index].expRequired &&
|
|
!t->isBilding;
|
|
}
|
|
void update();
|
|
void setScene(QGraphicsScene * scene_) {scene = scene_;}
|
|
|
|
signals:
|
|
void shot(const TowerType &tow);
|
|
// void tower_killed(QPoint id);
|
|
|
|
public slots:
|
|
|
|
private:
|
|
Game_Data * gameData;
|
|
QGraphicsScene * scene;
|
|
};
|
|
|
|
#endif // TOWERS_H
|