Reimplement wave AI, split out some UI code into a ui module, update TODO

This commit is contained in:
2022-05-10 05:28:01 +02:00
parent 2f63695ee9
commit 75debe1905
15 changed files with 588 additions and 248 deletions

View File

@@ -0,0 +1,55 @@
package gg.malloc.defense.engine;
import gg.malloc.defense.model.Wave;
import gg.malloc.defense.model.Game;
public class WaveManager {
int m_currentWaveNum = 0;
int m_currentBatch = 0;
Wave m_currentWave = null;
Game m_game;
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 double progress() {
return (double)m_currentWaveNum / (double)m_game.getWaveCount();
}
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);
}
}