(renderArea: RenderArea)
| 43 | |
| 44 | // Public methods |
| 45 | public draw(renderArea: RenderArea): void{ |
| 46 | // Draw if we should be drawn |
| 47 | if(this.shouldBeDrawn){ |
| 48 | switch(this.positionType){ |
| 49 | case QuestEntityHealthBarPositionType.FIXED_ON_PAGE: |
| 50 | renderArea.drawArea(this.bar, ((this.questEntity.getQuest().getRenderArea().getWidth()-100) - this.questEntity.getQuest().getGap())/2 + this.questEntity.getQuest().getRealQuestPosition().x + this.position.x + this.questEntity.getQuest().getGlobalDrawingOffset().x, this.questEntity.getQuest().getRealQuestPosition().y + this.position.y + this.questEntity.getQuest().getGlobalDrawingOffset().y, new RenderTransparency(" ")); |
| 51 | break; |
| 52 | case QuestEntityHealthBarPositionType.FIXED: |
| 53 | renderArea.drawArea(this.bar, this.questEntity.getQuest().getRealQuestPosition().x + this.position.x + this.questEntity.getQuest().getGlobalDrawingOffset().x, this.questEntity.getQuest().getRealQuestPosition().y + this.position.y + this.questEntity.getQuest().getGlobalDrawingOffset().y, new RenderTransparency(" ")); |
| 54 | break; |
| 55 | case QuestEntityHealthBarPositionType.RELATIVE: |
| 56 | if(this.questEntity.getQuest().getRealQuestPosition().x + this.questEntity.getGlobalPosition().x + this.position.x > 0 && // If the bar fit at the left |
| 57 | this.questEntity.getQuest().getRealQuestPosition().x + this.questEntity.getGlobalPosition().x + this.position.x + this.bar.getWidth() <= renderArea.getWidth() && // And at the right too |
| 58 | this.questEntity.getGlobalPosition().y + this.position.y > 0 && // And at the top |
| 59 | this.questEntity.getGlobalPosition().y + this.position.y <= this.questEntity.getQuest().getRealQuestSize().y // And at the bottom |
| 60 | ){ |
| 61 | renderArea.drawArea(this.bar, this.questEntity.getQuest().getRealQuestPosition().x + this.questEntity.getGlobalPosition().x + this.position.x + this.questEntity.getQuest().getGlobalDrawingOffset().x, this.questEntity.getQuest().getRealQuestPosition().y + this.questEntity.getGlobalPosition().y + this.position.y + this.questEntity.getQuest().getGlobalDrawingOffset().y, new RenderTransparency(" ")); |
| 62 | } |
| 63 | break; |
| 64 | } |
| 65 | } |
| 66 | } |
| 67 | |
| 68 | public update(): void{ |
| 69 | // If we should draw the bar even if full or it isn't full, then we set that we should draw it |
nothing calls this directly
no test coverage detected