GAM456-SpaceInvaders / SpaceInvaders / 4_GameObject / Bumper / BumperRoot.cs
BumperRoot.cs
Raw
using System;
using System.Diagnostics;


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

        public BumperRoot(GameObject.ObjectName objName, Sprite.SpriteName spriteName, float x, float y)
            : base(objName, spriteName)
        {
            this.x = x;
            this.y = y;
            this.name = objName;
            this.pColObj.pCollisionSprite.SetColor(1.0f, 1.0f, 0.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(ShipRoot ship)
        {
            CollisionPair.CollidePair(ship, (GameObject)ForwardIterator.GetChild(this));
        }


    } //end class

} //end namespace