~mzanetti/+junk/ubuntudefence

« back to all changes in this revision

Viewing changes to engine.h

  • Committer: Michael Zanetti
  • Date: 2014-07-06 01:09:39 UTC
  • Revision ID: michael.zanetti@canonical.com-20140706010939-x2m8q24bgwuj867b
add support for locking levels and properly collect level reward points

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
    Q_PROPERTY(LevelPacks* levelPacks READ levelPacks CONSTANT)
24
24
    Q_PROPERTY(LevelPack* levelPack READ levelPack NOTIFY levelPackChanged)
25
25
    Q_PROPERTY(int levelCount READ levelCount NOTIFY levelCountChanged)
 
26
    Q_PROPERTY(int highestUnlockedLevel READ highestUnlockedLevel NOTIFY highestUnlockedLevelChanged)
26
27
    Q_PROPERTY(int points READ points NOTIFY pointsChanged)
27
28
    Q_PROPERTY(int lives READ lives NOTIFY livesChanged)
28
29
    Q_PROPERTY(int level READ level NOTIFY levelChanged)
52
53
 
53
54
    int levelCount() const;
54
55
 
 
56
    int highestUnlockedLevel() const;
 
57
 
55
58
    int points() const;
56
59
 
57
60
    int lives() const;
88
91
    void pointsChanged();
89
92
    void livesChanged();
90
93
    void levelChanged();
 
94
    void highestUnlockedLevelChanged();
91
95
    void playStatusChanged();
92
96
    void wavesChanged();
93
97
    void currentWaveChanged();
109
113
 
110
114
private:
111
115
    QString levelFile(int level);
112
 
    bool loadLevelFile(int level);
 
116
    bool loadLevel(int index);
113
117
    void loadEnemies();
114
118
    void loadTowers();
 
119
    void loadLevels();
115
120
 
116
121
    void savePoints();
117
122
    void loadPoints();
118
123
 
 
124
    void loadHighestUnlockedLevel();
 
125
    void saveHighestUnlockedLevel();
 
126
 
 
127
    int loadLevelHighscore(int level);
 
128
    void saveLevelHighscore(int level, int highscore);
 
129
 
119
130
private:
120
131
    LevelPacks *m_levelPacks;
121
132
    LevelPack *m_levelPack;
123
134
    int m_lives;
124
135
    int m_levelCount;
125
136
    int m_level;
 
137
    int m_highestUnlockedLevel;
126
138
    PlayStatus m_playStatus;
127
139
 
128
140
    Board *m_board;
129
141
    EnemyFactory *m_enemyFactory;
130
142
    TowerFactory *m_towerFactory;
131
 
    QList<Wave*> m_waves;
 
143
    QList<Wave> m_waves;
132
144
    int m_currentWave;
133
145
 
134
146
    int m_money;