コード例 #1
0
        public override void Notify()
        {
            //Debug.WriteLine("Shoot Observer");
            CoreCannon pShip = GameStateManager.GetGame().GetStateCoreCannonManager().GetShip();

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

            pCoreCannon.MoveRight();
        }
コード例 #3
0
        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);
        }
コード例 #4
0
ファイル: RightBumper.cs プロジェクト: beelandc/SpaceInvaders
        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();
        }
コード例 #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);
 }
コード例 #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);
        }
コード例 #7
0
        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;
        }
コード例 #8
0
        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);
            }
        }
コード例 #9
0
        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);
        }
コード例 #10
0
 // state()
 public abstract void Handle(CoreCannon pCoreCannon);
コード例 #11
0
 // strategy()
 public abstract void ShootMissile(CoreCannon pCoreCannon);
コード例 #12
0
 public virtual void VisitCoreCannon(CoreCannon cc)
 {
     // no differed to subcass
     Debug.WriteLine("Visit by CoreCannon not implemented");
     Debug.Assert(false);
 }
コード例 #13
0
 public override void MoveRight(CoreCannon pCoreCannon)
 {
     // Do Nothing - Left only
 }
コード例 #14
0
 public abstract void MoveLeft(CoreCannon pCoreCannon);
コード例 #15
0
 // strategy()
 public abstract void MoveRight(CoreCannon pCoreCannon);
コード例 #16
0
 public override void MoveLeft(CoreCannon pCoreCannon)
 {
     // Do Nothing - Right Only
 }
コード例 #17
0
 public override void MoveRight(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetX(pCoreCannon.GetX() + pCoreCannon.GetShipSpeed());
 }
コード例 #18
0
 public override void MoveLeft(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetX(pCoreCannon.GetX() - pCoreCannon.GetShipSpeed());
 }
コード例 #19
0
        public override void Notify()
        {
            CoreCannon pShip = GameStateManager.GetGame().GetStateCoreCannonManager().GetShip();

            pShip.SetMissileState(CoreCannonManager.MissileState.Ready);
        }
コード例 #20
0
 public override void ShootMissile(CoreCannon pShip)
 {
     // Do Nothing
 }
コード例 #21
0
ファイル: KeyInput.cs プロジェクト: codybartman/SpaceInvaders
 public Controls(ref CoreCannon playerIn)
 {
     player = playerIn;
 }
コード例 #22
0
 public override void Handle(CoreCannon pShip)
 {
     // Do Nothing - Observer will change state
 }
コード例 #23
0
 public override void Handle(CoreCannon pCoreCannon)
 {
     pCoreCannon.SetMissileState(CoreCannonManager.MissileState.MissileFlying);
 }
コード例 #24
0
 public override void Handle(CoreCannon pShip)
 {
     // Do nothing
 }