()
| 57 | } |
| 58 | |
| 59 | public update(): void{ |
| 60 | if(this.getQuestEnded() == false){ |
| 61 | // Test if the player is dead, if so, end the quest and return |
| 62 | if(this.getGame().getPlayer().shouldDie()){ |
| 63 | this.endQuest(false); |
| 64 | return; |
| 65 | } |
| 66 | |
| 67 | // Test if the player won the quest, if so, end the quest and return |
| 68 | if(this.thePlayerWon()){ |
| 69 | this.endQuest(true); |
| 70 | return; |
| 71 | } |
| 72 | |
| 73 | // Handle sentences |
| 74 | this.handleSentences(); |
| 75 | |
| 76 | // Update entities |
| 77 | this.updateEntities(); |
| 78 | } |
| 79 | |
| 80 | // Draw |
| 81 | this.preDraw(); |
| 82 | this.drawEntities(); |
| 83 | this.drawSentences(); // Draw the sentences |
| 84 | this.drawAroundQuest(); |
| 85 | if(this.getQuestEnded() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeeping"); |
| 86 | else if(this.getQuestEndedAndWeWon() == false) this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestNoKeepingBecauseLose"); |
| 87 | else this.addExitQuestButton(new CallbackCollection(this.getGame().goToMainMap.bind(this.getGame())), "buttonExitQuestKeeping"); |
| 88 | this.postDraw(); |
| 89 | } |
| 90 | |
| 91 | // Private methods |
| 92 | private addYourself(): void{ |
no test coverage detected