Reimplement wave AI, split out some UI code into a ui module, update TODO
This commit is contained in:
55
src/main/java/gg/malloc/defense/engine/WaveManager.java
Normal file
55
src/main/java/gg/malloc/defense/engine/WaveManager.java
Normal 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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user