using System; using System.Diagnostics; namespace SpaceInvaders { public class AlienColumn : Composite { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public AlienColumn(GameObject.ObjectName objName, Sprite.SpriteName spriteName, float x, float y) : base(objName, spriteName) { this.x = x; this.y = y; this.pColObj.pCollisionSprite.SetColor(0.0f, 0.0f, 1.0f); } //------------------------------------------------------------------- // PUBLIC METHODS //------------------------------------------------------------------- public void ResurrectCol(float x, float y) { this.x = x; this.y = y; this.SetCollisionColor(0.0f, 0.0f, 1.0f); base.Ressurect(); } public override void Update() { base.UpdateBoundingBox(this); base.Update(); } public override void Remove() { Debug.WriteLine("Removing: {0}", this.name); this.pColObj.pCollisionRect.Set(0.0f, 0.0f, 0.0f, 0.0f); base.Update(); //update parent (root) GameObject pParent = (GameObject)this.pParent; pParent.Update(); //remove it base.Remove(); } public override void PrintComponent() { Debug.WriteLine("\nColumn:"); // walk through the list and render Iterator pIt = this.pDLinkMan.GetIterator(); Debug.Assert(pIt != null); GameObject pNode = (GameObject)pIt.First(); // Walk through the nodes while (!pIt.IsDone()) { // Update the node Debug.Assert(pNode != null); pNode.PrintComponent(); pNode = (GameObject)pIt.Next(); } } //------------------------------------------------------------------- // VISITOR METHODS //------------------------------------------------------------------- public override void Accept(Visitor other) { other.Visit(this); } public override void Visit(MissileGroup missile) { CollisionPair.CollidePair(missile,(GameObject)ForwardIterator.GetChild(this)); } } //end class } //end namespace