Add: HeartManager, HeartGauge

This commit is contained in:
2018-05-15 09:07:17 +09:00
parent b89490facd
commit 407f95f26f
9 changed files with 240 additions and 34 deletions
+13 -2
View File
@@ -12,6 +12,12 @@ class Game {
});
let scoreBoard = new ScoreBoard();
let heartGauge = new HeartGauge(heartManager);
heartManager.addOnChangeGameOverListener(
() => {
this.gameOver();
}
);
let fullscreenButton = new FullscreenButton(this.game);
@@ -45,11 +51,11 @@ class Game {
screenBottom.printBottomRightText(sessionStorageManager.playerName);
scoreManager.addOnChangeScoreFunctions( score => {
scoreManager.addOnChangeScoreListener( score => {
console.log("onChangeScore : " + score);
scoreBoard.printScore(NumberUtil.numberWithCommas(score));
});
scoreManager.addOnChangeHighScoreFunctions( highScore => {
scoreManager.addOnChangeHighScoreListener( highScore => {
console.log("onChangeHighScore : " + highScore);
screenBottom.printBottomLeftText("최고 기록 : " + NumberUtil.numberWithCommas(highScore));
});
@@ -94,6 +100,10 @@ class Game {
this.activateNextAlien();
}
gameOver() {
console.log("gameOver");
}
activateNextAlien() {
if(this.activatedAlienIndex === this.aliens.length)
return;
@@ -109,6 +119,7 @@ class Game {
onAlienEscaped() {
console.log("onAlienEscaped");
heartManager.breakHearts(1);
}
}