using System; using System.Diagnostics; namespace SpaceInvaders { public class WallGroup : Composite { //------------------------------------------------------------------- // CONSTRUCTION //------------------------------------------------------------------- public WallGroup(GameObject.ObjectName name, Sprite.SpriteName spriteName, float x, float y) : base(name, spriteName) { this.name = name; this.x = x; this.y = y; this.pColObj.pCollisionSprite.SetColor(1.0f, 1.0f, 1.0f); } //------------------------------------------------------------------- // PUBLIC METHODS //------------------------------------------------------------------- public override void Update() { base.UpdateBoundingBox(this); base.Update(); } //------------------------------------------------------------------- // VISITOR METHODS //------------------------------------------------------------------- public override void Accept(Visitor other) { other.Visit(this); } //Alien Collision public override void Visit(AlienGrid alien) { //alien grid vs wall group CollisionPair.CollidePair(alien, (GameObject)ForwardIterator.GetChild(this)); } public override void Visit(UFOAlienRoot alien) { CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(this), alien); } //Missile Collision public override void Visit(MissileGroup missile) { //missile group vs wall group CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(missile), this); } public override void Visit(Missile missile) { //missile vs wall group CollisionPair.CollidePair(missile, (GameObject)ForwardIterator.GetChild(this)); } } }