Skip preupdate/update for PIXI hierarchies in which an ancestor doesn't exist

This commit is contained in:
Cameron Foale
2013-11-19 16:29:02 +11:00
parent e43571980d
commit 7ef5ab8c98
2 changed files with 17 additions and 6 deletions
+11 -4
View File
@@ -72,24 +72,31 @@ Phaser.World.prototype.boot = function () {
Phaser.World.prototype.update = function () {
this.currentRenderOrderID = 0;
if (this.game.stage._stage.first._iNext)
{
var currentNode = this.game.stage._stage.first._iNext;
var skipChildren = false;
do
{
if (currentNode['preUpdate'])
{
currentNode.preUpdate();
skipChildren = (currentNode.preUpdate() == false);
}
if (currentNode['update'])
{
currentNode.update();
skipChildren = (currentNode.update() == false) || skipChildren;
}
currentNode = currentNode._iNext;
if(skipChildren)
{
currentNode = currentNode.last._iNext;
} else {
currentNode = currentNode._iNext;
}
}
while (currentNode != this.game.stage._stage.last._iNext)
}