()
| 79 | } |
| 80 | |
| 81 | public update(): void{ |
| 82 | // If we target an entity |
| 83 | if(this.targetType == FireballTargetType.TARGET_ENTITY){ |
| 84 | // If this entity is still alive |
| 85 | if(this.fireballTargetEntity != null && this.fireballTargetEntity.getDead() == false){ |
| 86 | // We go towards it |
| 87 | this.goTowards(this.getGlobalPosition().plus(new Pos(Math.floor(this.size.x/2), Math.floor(this.size.y/2))), this.fireballTargetEntity.getRenderAreaCenter(), 0, this.speed); |
| 88 | } |
| 89 | // Else, we die |
| 90 | else this.setDead(true); |
| 91 | } |
| 92 | // Else, if we target to stick on an entity |
| 93 | else if(this.targetType == FireballTargetType.TARGET_STICK_ON_ENTITY){ |
| 94 | // If this entity is still alive |
| 95 | if(this.fireballTargetEntity != null && this.fireballTargetEntity.getDead() == false){ |
| 96 | // We teleport on it |
| 97 | this.teleport(this.fireballTargetEntity.getGlobalPosition().plus(this.specialTargetPosition)); |
| 98 | } |
| 99 | // Else, we die |
| 100 | else this.setDead(true); |
| 101 | } |
| 102 | // Else, if we target a position |
| 103 | else if(this.targetType == FireballTargetType.TARGET_POSITION){ |
| 104 | // We go towards this position |
| 105 | this.goTowards(this.getGlobalPosition().plus(new Pos(Math.floor(this.size.x/2), Math.floor(this.size.y/2))), this.targetPosition, 0, this.speed); |
| 106 | } |
| 107 | |
| 108 | // Handle our damage |
| 109 | this.handleDamage(); |
| 110 | |
| 111 | // Call the mother class update method |
| 112 | super.update(); |
| 113 | } |
| 114 | |
| 115 | // willDie() |
| 116 | public willDie(): void{} |
nothing calls this directly
no test coverage detected