57 lines
1.1 KiB
Java
57 lines
1.1 KiB
Java
package gg.malloc.defense.engine;
|
|
|
|
import gg.malloc.defense.model.Wave;
|
|
import gg.malloc.defense.model.Game;
|
|
import gg.malloc.defense.model.Progress;
|
|
|
|
public class WaveManager {
|
|
int m_currentWaveNum = 0;
|
|
int m_currentBatch = 0;
|
|
Wave m_currentWave = null;
|
|
Game m_game;
|
|
|
|
public Progress asProgress() {
|
|
return new StaticProgress(m_currentWaveNum, m_game.getWaveCount());
|
|
}
|
|
|
|
public WaveManager(Game game) {
|
|
m_game = game;
|
|
}
|
|
|
|
public void reset() {
|
|
m_currentWaveNum = 0;
|
|
m_currentBatch = 0;
|
|
m_currentWave = null;
|
|
}
|
|
|
|
public Wave currentWave() {
|
|
return m_currentWave;
|
|
}
|
|
|
|
public int currentWaveNum() {
|
|
return m_currentWaveNum;
|
|
}
|
|
|
|
public int currentBatchNum() {
|
|
return m_currentBatch;
|
|
}
|
|
|
|
public boolean isLastWave() {
|
|
return m_currentWaveNum >= m_game.getWaveCount();
|
|
}
|
|
|
|
public boolean isLastBatch() {
|
|
return m_currentBatch >= m_currentWave.batchCount();
|
|
}
|
|
|
|
public void nextBatch() {
|
|
m_currentBatch += 1;
|
|
}
|
|
|
|
public void next() {
|
|
m_currentWaveNum += 1;
|
|
m_currentBatch = 0;
|
|
m_currentWave = m_game.getWave(m_currentWaveNum);
|
|
}
|
|
}
|