GAM456-SpaceInvaders / SpaceInvaders / 4_GameObject / Shield / ShieldGrid.cs
ShieldGrid.cs
Raw
using System;
using System.Diagnostics;


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

        public ShieldGrid(GameObject.ObjectName objName, Sprite.SpriteName spriteName, float x, float y) 
            : base(objName, spriteName)
        {
            this.x = x;
            this.y = y;

            this.SetCollisionColor(0.0f, 0.0f, 1.0f);
        }


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

        public void Resurrect(float x, float y)
        {
            this.x = x;
            this.y = y;

            this.SetCollisionColor(0.0f, 0.0f, 1.0f);
            base.Ressurect();
        }

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


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

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

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

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

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

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

    } //end class

} //end namespace