public override void Notify()
        {
            //Debug.WriteLine("Shoot Observer");
            CoreCannon pShip = GameStateManager.GetGame().GetStateCoreCannonManager().GetShip();

            pShip.ShootMissile();
        }
Exemple #2
0
        public override void Notify()
        {
            //Debug.WriteLine("Move Right");
            CoreCannon pCoreCannon = GameStateManager.GetGame().GetStateCoreCannonManager().GetShip();

            pCoreCannon.MoveRight();
        }
        public CoreCannon ActivateCoreCannon()
        {
            // copy over safe copy
            CoreCannon pCoreCannon = new CoreCannon(GameObject.Name.CoreCannon, Sprite.Name.CoreCannon, 200, 100);

            this.pCoreCannon = pCoreCannon;

            // Attach to GameObjectManager - {update and collisions}
            GameStateManager.GetGame().GetStateGameObjectManager().Attach(pCoreCannon);

            // Attach the sprite to the correct sprite batch
            SpriteBatch pCoreCannon_SpriteBatch   = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CoreCannon);
            SpriteBatch pCollisionBox_SpriteBatch = GameStateManager.GetGame().GetStateSpriteBatchManager().Find(SpriteBatch.Name.CollisionBox);

            pCoreCannon.ActivateSprite(pCoreCannon_SpriteBatch);
            pCoreCannon.ActivateCollisionSprite(pCollisionBox_SpriteBatch);

            // Attach the Core Cannon to the CoreCannonGroup
            GameObject pCoreCannonGroup = GameStateManager.GetGame().GetStateGameObjectManager().Find(GameObject.Name.CoreCannonGroup);

            Debug.Assert(pCoreCannonGroup != null);

            // Add to Composite
            pCoreCannonGroup.Add(this.pCoreCannon);

            this.pCoreCannon.SetMissileState(CoreCannonManager.MissileState.Ready);
            this.pCoreCannon.SetMoveState(CoreCannonManager.MoveState.Free);

            return(this.pCoreCannon);
        }
        public override void VisitCoreCannon(CoreCannon cc)
        {
            // CoreCannon vs RightBumper
            // Debug.WriteLine("collide: {0} with {1}", this, a);

            CollisionPair pColPair = CollisionPairManager.GetActiveColPair();

            Debug.Assert(pColPair != null);
            pColPair.SetCollision(cc, this);
            pColPair.NotifyListeners();
        }
Exemple #5
0
 //-----------------------------------------------------------------------------
 // Game::Initialize()
 //		Allows the engine to perform any initialization it needs to before
 //      starting to run.  This is where it can query for any required services
 //      and load any non-graphic related content.
 //-----------------------------------------------------------------------------
 public override void Initialize()
 {
     menu       = new Menu();
     characters = new CharManager();
     aliens     = new AlienArmy();
     player1    = new CoreCannon();
     collision  = new CollisionSystem();
     // Game Window Device setup
     this.SetWindowName("->Set Screen Title Name Here<-");
     this.SetWidthHeight(GameSpecs.ScreenWidth, GameSpecs.ScreenHeight);
     this.SetClearColor(0.0f, 0.0f, 0.0f, 0.0f);
 }
Exemple #6
0
        public override void ShootMissile(CoreCannon pShip)
        {
            // Activate and position missile
            Missile pMissile = GameStateManager.GetGame().GetStateCoreCannonManager().ActivateMissile();

            pMissile.SetPos(pShip.GetX(), pShip.GetY() + 20);
            pMissile.SetActive(true);

            // Play shoot sound
            IrrKlang.ISound pSnd = SoundEngineManager.GetSoundEngine().Play2D("shoot.wav");

            // switch states
            this.Handle(pShip);
        }
        public CoreCannonManager()
        {
            // Store the states
            this.pReadyState         = new CoreCannonReadyState();
            this.pMissileFlyingState = new CoreCannonMissileFlyingState();
            this.pEndState           = new CoreCannonEndState();

            this.pFreeState      = new CoreCannonFreeState();
            this.pLeftOnlyState  = new CoreCannonLeftOnlyState();
            this.pRightOnlyState = new CoreCannonRightOnlyState();

            // set active
            this.pCoreCannon = null;
            this.pMissile    = null;
        }
        public override void Notify()
        {
            //Debug.WriteLine("    CoreCannon_Wall_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            CoreCannon pCoreCannon = (CoreCannon)this.pSubject.pObjA;
            Wall       pWall       = (Wall)this.pSubject.pObjB;

            if (pWall.GetType() == typeof(LeftBumper))
            {
                pCoreCannon.SetMoveState(CoreCannonManager.MoveState.RightOnly);
            }
            else if (pWall.GetType() == typeof(RightBumper))
            {
                pCoreCannon.SetMoveState(CoreCannonManager.MoveState.LeftOnly);
            }
            else
            {
                Debug.Print("Unexpected Wall type in CoreCannon_Wall_Observer");
                Debug.Assert(false);
            }
        }
        public override void Execute(float deltaTime)
        {
            spriteProxyRect      = this.pGameObject.GetSpriteProxy().GetSpriteScreenRect();
            spriteProxyHalfWidth = spriteProxyRect.width / 2.0f;

            this.currX = this.pGameObject.GetX();
            this.currY = this.pGameObject.GetY() + this.deltaY;

            // If past window top, reset
            if (this.currY > 896.0f)
            {
                // Set to Ship location + some Y
                CoreCannon ship = (CoreCannon)GameStateManager.GetGame().GetStateGameObjectManager().Find(GameObject.Name.CoreCannon);
                this.currX = ship.GetX();
                this.currY = ship.GetY() + 20.0f;
            }

            // Update X, Y in Sprite
            this.pGameObject.SetX(this.currX);
            this.pGameObject.SetY(this.currY);

            // Add itself back to timer
            TimerManager.Add(TimeEvent.Name.MissileMovement, this, deltaTime);
        }
Exemple #10
0
 // state()
 public abstract void Handle(CoreCannon pCoreCannon);
Exemple #11
0
 // strategy()
 public abstract void ShootMissile(CoreCannon pCoreCannon);
 public virtual void VisitCoreCannon(CoreCannon cc)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by CoreCannon not implemented");
     Debug.Assert(false);
 }
 public override void MoveRight(CoreCannon pCoreCannon)
 {
     // Do Nothing - Left only
 }
 public abstract void MoveLeft(CoreCannon pCoreCannon);
 // strategy()
 public abstract void MoveRight(CoreCannon pCoreCannon);
 public override void MoveLeft(CoreCannon pCoreCannon)
 {
     // Do Nothing - Right Only
 }
 public override void MoveRight(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetX(pCoreCannon.GetX() + pCoreCannon.GetShipSpeed());
 }
 public override void MoveLeft(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetX(pCoreCannon.GetX() - pCoreCannon.GetShipSpeed());
 }
        public override void Notify()
        {
            CoreCannon pShip = GameStateManager.GetGame().GetStateCoreCannonManager().GetShip();

            pShip.SetMissileState(CoreCannonManager.MissileState.Ready);
        }
 public override void ShootMissile(CoreCannon pShip)
 {
     // Do Nothing
 }
Exemple #21
0
 public Controls(ref CoreCannon playerIn)
 {
     player = playerIn;
 }
 public override void Handle(CoreCannon pShip)
 {
     // Do Nothing - Observer will change state
 }
Exemple #23
0
 public override void Handle(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetMissileState(CoreCannonManager.MissileState.MissileFlying);
 }
Exemple #24
0
 public override void Handle(CoreCannon pShip)
 {
     // Do nothing
 }