using System; using System.Diagnostics; namespace SpaceInvaders { public class RightWall : Walls { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public RightWall(GameObject.ObjectName objName, Sprite.SpriteName spriteName, float x, float y, float width, float height) : base(objName, spriteName, x, y, Walls.WallType.Right) { 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); Debug.WriteLine(" --->DONE<----"); //alien grid vs right wall CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(this, alien); pPair.NotifyListeners(); } public override void Visit(UFOAlienRoot alien) { CollisionPair.CollidePair(this, (GameObject)ForwardIterator.GetChild(alien)); } public override void Visit(UFOAlien alien) { //alien grid vs left wall CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(this, alien); 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); //Debug.WriteLine(" --->DONE<----"); //ship vs left bumper CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(ship, this); pPair.NotifyListeners(); } public override void Visit(BombRoot bomb) { CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(bomb), this); } public override void Visit(Bomb bomb) { CollisionPair pPair = CollisionPairMan.GetActivePair(); Debug.Assert(pPair != null); pPair.SetCollision(bomb, this); pPair.NotifyListeners(); } } }