()
| 53 | |
| 54 | // Private methods |
| 55 | private actionInterval(): void{ |
| 56 | // Do something different depending on the step |
| 57 | switch(this.step){ |
| 58 | case DragonStep.PLAYER_MOVING: |
| 59 | // Move the player |
| 60 | this.playerPos += 1; |
| 61 | if(this.playerPos >= 60){ // If we made it to the dragon |
| 62 | // We're now attacking |
| 63 | this.step = DragonStep.PLAYER_ATTACKING; |
| 64 | // Set the countdown |
| 65 | this.playerAttackingCountdown = 40; |
| 66 | } |
| 67 | // Update |
| 68 | this.update(); |
| 69 | this.getGame().updatePlace(); |
| 70 | break; |
| 71 | case DragonStep.PLAYER_ATTACKING: |
| 72 | // Lower the countdown |
| 73 | this.playerAttackingCountdown -= 1; |
| 74 | if(this.playerAttackingCountdown < 0){ // If it's time to stop attacking |
| 75 | // We're now "stop tickling" |
| 76 | this.step = DragonStep.STOP_TICKLING; |
| 77 | } |
| 78 | // Update |
| 79 | this.update(); |
| 80 | this.getGame().updatePlace(); |
| 81 | break; |
| 82 | } |
| 83 | } |
| 84 | |
| 85 | private chooseCandies(): void{ |
| 86 | // Change the step |
nothing calls this directly
no test coverage detected