using System; using System.Diagnostics; namespace SpaceInvaders { public class LeftWall : Walls { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public LeftWall(GameObject.ObjectName objName, Sprite.SpriteName spriteName, float x, float y, float width, float height) : base(objName, spriteName, x, y, Walls.WallType.Left) { this.x = x; this.y = y; this.pColObj.pCollisionRect.Set(x, y, width, height); this.pColObj.pCollisionSprite.SetColor(1.0f, 1.0f, 0.0f); } //------------------------------------------------------------------- // PUBLIC METHODS //------------------------------------------------------------------- public override void Update() { base.Update(); } //------------------------------------------------------------------- // VISITOR METHODS //------------------------------------------------------------------- public override void Accept(Visitor other) { other.Visit(this); } public override void Visit(AlienGrid alien) { //Debug.WriteLine("\ncollide: {0} with {1}", this, alien); //alien grid vs left wall CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(alien, this); pPair.NotifyListeners(); } //Ship collision public override void Visit(ShipRoot ship) { //ship group vs left bumper CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(ship), this); } public override void Visit(Ship ship) { //Debug.WriteLine("\ncollide: {0} with {1}", this, ship); //ship vs left bumper CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(ship, this); pPair.NotifyListeners(); } } }