Last active
December 17, 2015 08:28
-
-
Save mnem/5579815 to your computer and use it in GitHub Desktop.
Not sure if bug, or just user error.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package | |
{ | |
import ash.core.Engine; | |
import ash.core.Entity; | |
import flash.display.Sprite; | |
public class Main extends Sprite | |
{ | |
public function Main() | |
{ | |
var engine:Engine = new Engine(); | |
var a:Entity = new Entity("a"); | |
var b:Entity = new Entity("b"); | |
var c:Entity = new Entity("c"); | |
var d:Entity = new Entity("d"); | |
engine.addEntity(a); | |
engine.addEntity(b); | |
engine.addEntity(c); | |
printEntities(engine.entities, "Starting list"); | |
engine.removeEntity(b); | |
printEntities(engine.entities, "Removed b"); | |
engine.addEntity(d); | |
printEntities(engine.entities, "Added d"); | |
engine.removeEntity(c); | |
printEntities(engine.entities, "Removed c"); | |
engine.removeEntity(b); | |
printEntities(engine.entities, "Removed b again"); | |
} | |
private function printEntities(entities:Vector.<Entity>, message:String):void | |
{ | |
var names:Array = []; | |
for (var i:int = 0; i < entities.length; i++) | |
{ | |
var entity:Entity = entities[i]; | |
names.push(entity.name); | |
} | |
trace("LIST: " + names.join(", ") + " (" + message + ")"); | |
} | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[trace] LIST: a, b, c (Starting list) | |
[trace] LIST: a, c (Removed b) | |
[trace] LIST: a, c, d (Added d) | |
[trace] LIST: a, d (Removed c) | |
[trace] LIST: a, c, d (Removed b again) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment