GAM456-SpaceInvaders / SpaceInvaders / 4_GameObject / Bomb / BombRoot.cs
BombRoot.cs
Raw
using System;
using System.Diagnostics;


namespace SpaceInvaders
{
    public class BombRoot : Composite
    {
        //-------------------------------------------------------------------
        //  CONSTRUCTION
        //-------------------------------------------------------------------

        public BombRoot(GameObject.ObjectName name, Sprite.SpriteName spriteName, float x, float y)
            : base(name, spriteName)
        {
            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);
        }

        public override void Visit(MissileGroup missile)
        {
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(missile), this);
        }

        public override void Visit(Missile missile)
        {
            CollisionPair.CollidePair(missile,(GameObject)ForwardIterator.GetChild(this));
        }

        public override void Visit(WallGroup wall)
        {
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(wall), this);
        }

        public override void Visit(BottomWall wall)
        {
            CollisionPair.CollidePair(wall, (GameObject)ForwardIterator.GetChild(this));
        }

        public override void Visit(ShipRoot ship)
        {
            CollisionPair.CollidePair(ship, (GameObject)ForwardIterator.GetChild(this));
        }

        public override void Visit(ShieldGrid shield)
        {
            CollisionPair.CollidePair(shield, (GameObject)ForwardIterator.GetChild(this));
        }


    } // end class

} // end namespace