MCPcopy Create free account
hub / github.com/candybox2/candybox2.github.io / updateEntities

Method updateEntities

code/main/Quest.ts:655–683  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

653 public update(): void{}
654
655 public updateEntities(): void{
656 // We store the current length before calling update stuff
657 var length: number = this.entities.length;
658
659 // Call the update function on each entity
660 for(var i = 0; i < length; i++){
661 this.entities[i].update();
662 }
663
664 // Iterate over entities for removal (the only thing they can't do by themselves..)
665 for(var i = 0; i < this.entities.length; i++){
666 // If the entity should die, we remove it and we make the appropriate callback
667 if(this.entities[i].shouldDie()){
668 this.entities[i].willDie();
669 this.entities[i].setDead(true);
670 this.entities.splice(i, 1);
671 i--;
672 }
673 // Else, if the entity should be removed from the quest because it's out of the view, we remove it
674 else if(this.entities[i].isOutOfArea()){
675 this.entities[i].setOutOfArea(true);
676 this.entities.splice(i, 1);
677 i--;
678 }
679 }
680
681 // Lower countdowns
682 this.lowerCountdowns();
683 }
684
685 public willBeDisplayed(): void{
686 // Some some stuff needed because we start questing

Callers 15

updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80
updateMethod · 0.80

Calls 7

lowerCountdownsMethod · 0.95
setDeadMethod · 0.80
isOutOfAreaMethod · 0.80
setOutOfAreaMethod · 0.80
updateMethod · 0.45
shouldDieMethod · 0.45
willDieMethod · 0.45

Tested by

no test coverage detected