GAM456-SpaceInvaders / SpaceInvaders / 4_GameObject / Missile / MissileGroup.cs
MissileGroup.cs
Raw
using System;
using System.Diagnostics;


namespace SpaceInvaders
{
    public class MissileGroup : Composite
    {
        //-------------------------------------------------------------------
        //  CONSTRUCTION
        //-------------------------------------------------------------------
        public MissileGroup()
            : base()
        {
            this.name = ObjectName.MissileGroup;
            this.pColObj.pCollisionSprite.SetColor(0.0f, 0.0f, 1.0f);
        }


        //-------------------------------------------------------------------
        //  PUBLIC METHODS
        //-------------------------------------------------------------------

        public override void Update()
        {
            base.UpdateBoundingBox(this);
            base.Update();
        }


        //-------------------------------------------------------------------
        //  ACCEPT METHODS
        //-------------------------------------------------------------------

        public override void Accept(Visitor other)
        {
            other.Visit(this);
        }

        public override void Visit(AlienGrid alien)
        {
            //missile group vs alien grid
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(this), alien);
        }

        public override void Visit(UFOAlienRoot alien)
        {
            //missile group vs ufo root
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(alien), this);
        }

        public override void Visit(UFOAlien alien)
        {
            //missile vs squid alien
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(this), alien);
        }

        public override void Visit(BombRoot bomb)
        {
            //missile group vs bomb root
            CollisionPair.CollidePair((GameObject)ForwardIterator.GetChild(this), bomb);
        }


    } //end class

} //end namespace