#ifndef TOWER_H #define TOWER_H #include #include class Board; class Engine; class Enemy; class TowerConfig { public: int cost; QString image; int imageBaseSize; int spriteCount; qreal frameRate; QString shotImage; QString shotType; int damage; int shotDuration; int shotRecovery; int shotCount; QPoint shotCenter; int shotStartDistance; qreal radius; int slowdown; bool locked; int unlockPoints; int destroyReward; }; class Tower : public QObject { Q_OBJECT Q_ENUMS(ShotType) Q_PROPERTY(int id READ id CONSTANT) Q_PROPERTY(QString name READ name NOTIFY nameChanged) Q_PROPERTY(int levels READ levels NOTIFY levelsChanged) Q_PROPERTY(int level READ level NOTIFY levelChanged) Q_PROPERTY(QString image READ image NOTIFY levelChanged) Q_PROPERTY(int imageBaseSize READ imageBaseSize NOTIFY levelChanged) Q_PROPERTY(int spriteCount READ spriteCount NOTIFY levelChanged) Q_PROPERTY(qreal frameRate READ frameRate NOTIFY levelChanged) Q_PROPERTY(QString shotImage READ shotImage NOTIFY levelChanged) Q_PROPERTY(ShotType shotType READ shotType NOTIFY levelChanged) Q_PROPERTY(qreal radius READ radius NOTIFY levelChanged) Q_PROPERTY(int shotDuration READ shotDuration NOTIFY levelChanged) Q_PROPERTY(bool canShoot READ canShoot NOTIFY levelChanged) Q_PROPERTY(int shotCount READ shotCount NOTIFY levelChanged) Q_PROPERTY(QPoint shotCenter READ shotCenter NOTIFY levelChanged) Q_PROPERTY(int shotStartDistance READ shotStartDistance NOTIFY levelChanged) Q_PROPERTY(int damage READ damage NOTIFY levelChanged) Q_PROPERTY(int slowdown READ slowdown NOTIFY levelChanged) public: enum ShotType { ShotTypeSingle, ShotTypeBeam }; explicit Tower(int id, Engine *engine, QObject *parent = 0); void upgrade(); int id() const; QString name() const; void setName(const QString &name); void setConfigs(const QList &configs); int levels() const; int level() const; QString image() const; int imageBaseSize() const; int spriteCount() const; qreal frameRate() const; QString shotImage() const; ShotType shotType() const; qreal radius() const; int shotDuration() const; bool canShoot() const; int shotCount() const; QPoint shotCenter() const; int shotStartDistance() const; int damage() const; int slowdown() const; QList configs(); public slots: void shoot(Enemy *enemy); signals: void nameChanged(); void levelsChanged(); void levelChanged(); private slots: void recoverFromShot(); private: int m_id; Engine *m_engine; QString m_name; int m_level; QList m_configs; bool m_canShoot; }; #endif // TOWER_H