(newAction: CauldronAction)
| 85 | } |
| 86 | |
| 87 | private changeAction(newAction: CauldronAction): void{ |
| 88 | // If we're not already doing that |
| 89 | if(this.currentAction != newAction){ |
| 90 | // If the action which just stopped wasn't nothing |
| 91 | if(this.currentAction != CauldronAction.NOTHING){ |
| 92 | // Shift actions in the log |
| 93 | for(var i = this.actionLog.length-1; i > 0; i--){ |
| 94 | this.actionLog[i] = this.actionLog[i-1]; |
| 95 | } |
| 96 | // Set actionLog[0] to the action which just stopped |
| 97 | this.actionLog[0] = new CauldronActionLogEntry(this.currentAction, this.timerTime, this.getGame().getCandiesInCauldron().getCurrent(), this.getGame().getLollipopsInCauldron().getCurrent()); |
| 98 | } |
| 99 | // Now we're doing that |
| 100 | this.currentAction = newAction; |
| 101 | // Reset the timer and restart the interval |
| 102 | this.timerTime = 0; |
| 103 | clearInterval(this.timerIntervalID); |
| 104 | this.timerIntervalID = setInterval(this.actionInterval.bind(this), 1000); |
| 105 | // We reset the flames array |
| 106 | this.resetFlamesArray(); |
| 107 | // Update |
| 108 | this.update(); |
| 109 | this.getGame().updatePlace(); |
| 110 | } |
| 111 | } |
| 112 | |
| 113 | private changeCandiesInput(): void{ |
| 114 | if($(".cauldronCandiesInput").length) // If the element exists |
no test coverage detected