public static void KillAll() { DLinkedNode Child = GetGrid().GetFirstChild(); while (Child != null) { // Kill all Child DLinkedNode NextChild = Child.Next; // Kill all grand Child DLinkedNode GrandChild = ((AliensCol)Child).GetFirstChild(); while (GrandChild != null) { DLinkedNode NextGrandChild = GrandChild.Next; AlienLeaf tempGrandChild = ((AlienLeaf)GrandChild); ((AliensCol)Child).Remove(tempGrandChild); // Remove ProxySprite add Box Obj PlayBatchMan.Find(BatchName.Aliens).Remove(((AlienLeaf)GrandChild).GetProxy()); PlayBatchMan.Find(BatchName.Box).Remove(((AlienLeaf)GrandChild).CollisionObj.Box); GrandChild = NextGrandChild; } GetGrid().Remove((AliensCol)Child); // Remove Box Obj PlayBatchMan.Find(BatchName.Box).Remove(((AliensCol)Child).CollisionObj.Box); Child = NextChild; } }
private static void UpdateGridPos(float x, float y) { for (DLinkedNode Child = (AliensCol)GetGrid().GetFirstChild(); Child != null; Child = Child.Next) { // Alien Col do not have to update position, Since they will be updated By GameObjMan.Update() // Only add Box Obj to Box batch PlayBatchMan.Find(BatchName.Box).Add(((AliensCol)Child).CollisionObj.Box); // Alien leaf can be updated by their relative location for (DLinkedNode GrandChild = ((AliensCol)Child).GetFirstChild(); GrandChild != null; GrandChild = GrandChild.Next) { AlienLeaf tempGrandChild = ((AlienLeaf)GrandChild); tempGrandChild.x = x + 40 * tempGrandChild.locationX; tempGrandChild.y = y - 30 * tempGrandChild.locationY; tempGrandChild.CollisionObj.UpdatePos(tempGrandChild.x, tempGrandChild.y); // Update ProxySprite add Box Obj to batch PlayBatchMan.Find(BatchName.Aliens).Add(((AlienLeaf)GrandChild).GetProxy()); PlayBatchMan.Find(BatchName.Box).Add(((AlienLeaf)GrandChild).CollisionObj.Box); } } }
public virtual void Visit(AlienLeaf b) { }