Fix: wait and serve meats by waiter

This commit is contained in:
2019-12-11 11:32:17 +09:00
parent c7fb4aca9b
commit 37ba3a2eeb
4 changed files with 49 additions and 33 deletions
+16 -12
View File
@@ -148,6 +148,10 @@ var Game = {
this.heatPlate.onChangeDialLevel(dialLevel);
},
setClickEnable: function(value) {
this.isEnableClick = value;
},
back: function() {
sessionStorageManager.resetPlayingAppData();
location.href = '../../web/client/main_menu.html';
@@ -188,6 +192,7 @@ var Game = {
this.playingStageNo = 1;
this.clearedMeatCount = 0;
this.badMeatCount = 0;
this.badMeatCountPrevStage = 0;
this.startStage();
this.realtimeStageTimer.start();
@@ -195,30 +200,29 @@ var Game = {
startStage: function() {
this.clearedMeatCount = 0;
this.activatedMeatCount = this.getStageMeatCount();
this.serveNormalMeats();
this.activatedMeatCount = this.playingStageNo + 2;
this.serveBonusMeat();
this.badMeatCountPrevStage = this.badMeatCount;
this.badMeatCount = 0;
if(this.playingStageNo > 1)
if(this.playingStageNo > 1) {
this.waiter.animateServing();
game.time.events.add(Waiter.SERVING_WAIT_TIME_MS, this.serveMeats, this);
} else {
this.serveMeats();
}
},
setClickEnable: function(value) {
this.isEnableClick = value;
},
getStageMeatCount: function() {
this.activatedMeatCount = this.playingStageNo + 2;
return this.activatedMeatCount;
serveMeats: function() {
this.serveBonusMeat();
this.serveNormalMeats();
},
serveBonusMeat: function() {
if(this.playingStageNo == 1)
return;
if(this.badMeatCount > 0)
if(this.badMeatCountPrevStage > 0)
return;
if(this.bonusMeat.isActivate())
+18 -6
View File
@@ -34,15 +34,10 @@ MeatBase.prototype.update = function() {
MeatBase.prototype.initMeatTypeVariables = function() {
this.cookingSpeed = 0.0;
this.className = "MeatBase";
this.baseScale = 0.5;
this.className = "MeatBase";
}
MeatBase.prototype.initMeatTypeVariables = function() {
this.cookingSide = MeatBase.MEAT_NONE;
this.cookingTime = [];
this.cookingGrade = [];
@@ -60,6 +55,23 @@ MeatBase.prototype.initMeatTypeVariables = function() {
this.spriteNameRare = "";
this.spriteNameWelldone = "";
this.spriteNameBurnBlack = "";
this.initCookingSpeedArray();
this.initScoreArray();
}
MeatBase.prototype.initCookingSpeedArray = function() {
this.cookingSpeedArray = [];
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = 1;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = 2;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = 3;
}
MeatBase.prototype.initScoreArray = function() {
this.scoreArray = [];
this.scoreArray[MeatBase.DONENESS_RARE] = 0;
this.scoreArray[MeatBase.DONENESS_WELLDONE] = 0;
this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = 0;
}
MeatBase.prototype.initMouseEventHandler = function() {
+11 -11
View File
@@ -15,15 +15,15 @@ function NormalMeat(mainGame) {
NormalMeat.prototype.setNormalMeatTypeVariables = function() {
this.className = NormalMeat.CLASS_NAME;
this.cookingSpeedArray = [];
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG;
// this.cookingSpeedArray = [];
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_WEAK] = NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_NORMAL] = NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL;
this.cookingSpeedArray[HeatPlate.BURN_LEVEL_STRONG] = NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG;
this.scoreArray = [];
this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE;
this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_NAME_WELLDONE;
this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_NAME_BURN_BLACK;
// this.scoreArray = [];
this.scoreArray[MeatBase.DONENESS_RARE] = NormalMeat.SCORE_NAME_RARE;
this.scoreArray[MeatBase.DONENESS_WELLDONE] = NormalMeat.SCORE_WELLDONE;
this.scoreArray[MeatBase.DONENESS_BURN_BLACK] = NormalMeat.SCORE_BURN_BLACK;
}
NormalMeat.prototype.randomizeMeatType = function() {
@@ -61,9 +61,9 @@ NormalMeat.COOKING_SPEED_BURN_LEVEL_WEAK = 0.1;
NormalMeat.COOKING_SPEED_BURN_LEVEL_NORMAL = 0.2;
NormalMeat.COOKING_SPEED_BURN_LEVEL_STRONG = 0.3;
NormalMeat.SCORE_NAME_RARE = 1;
NormalMeat.SCORE_NAME_WELLDONE = 2;
NormalMeat.SCORE_NAME_BURN_BLACK = 1;
NormalMeat.SCORE_RARE = 1;
NormalMeat.SCORE_WELLDONE = 2;
NormalMeat.SCORE_BURN_BLACK = 1;
NormalMeat.SPRITE_NAME_RARE = "meat";
NormalMeat.SPRITE_NAME_WELLDONE = "meat_welldone";
+4 -4
View File
@@ -25,7 +25,7 @@ Waiter.prototype.animateServing = function() {
this.x = Waiter.POSITION_X;
this.show();
var tween = game.add.tween(this);
tween.to({x:200}, 300, Phaser.Easing.Linear.In, true, 0);
tween.to({x:200}, Waiter.SERVING_WAIT_TIME_MS, Phaser.Easing.Linear.In, true, 0);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Elastic.InOut, true, 0, 2, true);
// tween.to({x:0.7, y:0.7}, 1000, Phaser.Easing.Linear.None, true, 0);
// tween.onComplete.add(this.smileAgain, this);
@@ -47,7 +47,7 @@ Waiter.prototype.show = function() {
}
Waiter.POSITION_X = -150;
Waiter.POSITION_Y = 340;
Waiter.POSITION_Y = 340;
Waiter.SERVING_WAIT_TIME_MS = 300;