using System; using System.Diagnostics; namespace SpaceInvaders { public class ShipRoot : Composite { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public ShipRoot(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 override void Update() { base.UpdateBoundingBox(this); base.Update(); } public override void Remove() { Debug.WriteLine("Removing: {0}: ", this.name); this.pColObj.pCollisionRect.Set(0, 0, 0, 0); base.Update(); base.Remove(); } //------------------------------------------------------------------- // VISITOR METHODS //------------------------------------------------------------------- public override void Accept(Visitor other) { other.Visit(this); } public override void Visit(BumperRoot bumper) { CollisionPair.CollidePair(this, (GameObject)ForwardIterator.GetChild(bumper)); } public override void Visit(BombRoot bomb) { CollisionPair.CollidePair(this, (GameObject)ForwardIterator.GetChild(bomb)); } } //end class } //end namespace