using System; using System.Diagnostics; namespace SpaceInvaders { public class ShieldBrick : Shields { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public ShieldBrick(GameObject.ObjectName name, Sprite.SpriteName spriteName, float x, float y) :base(name, spriteName, x, y, Shields.ShieldType.Brick) { this.x = x; this.y = y; this.SetCollisionColor(1.0f, 0.0f, 0.0f); } //------------------------------------------------------------------- // PUBLIC METHODS //------------------------------------------------------------------- public void Resurrect(float x, float y) { this.x = x; this.y = y; base.Ressurect(); this.SetCollisionColor(1.0f, 0.0f, 0.0f); } public override void Update() { base.Update(); } public override void Remove() { //Debug.WriteLine("Removing: {0}", this.name); //set root obj size this.pColObj.pCollisionRect.Set(0, 0, 0, 0); base.Update(); //update parent (root) GameObject pParent = (GameObject)this.pParent; pParent.Update(); //remove it base.Remove(); } //------------------------------------------------------------------- // ACCEPT METHODS //------------------------------------------------------------------- public override void Accept(Visitor other) { other.Visit(this); } public override void Visit(Missile missile) { //missile vs brick CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(missile, this); pPair.NotifyListeners(); } public override void Visit(Bomb bomb) { //bomb vs brick CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(bomb, this); pPair.NotifyListeners(); } } //end class } // end namespace