public override void Notify()
        {
            GameObject pObject = this.pSubject.pObjA;

            this.pShip = (Ship)this.pSubject.pObjB;
            Debug.Assert(pShip != null);

            if (pShip.bMarkForDeath == false)
            {
                this.pShip.bMarkForDeath = true;

                //had initially tried to use the reference "this" ship
                //did not work FYI, needed to get the ship from manager
                Ship pShip = ShipMan.GetShip();

                pShip.SetShootState(ShipMan.ShootState.End);
                pShip.SetMoveState(ShipMan.MoveState.NoMove);


                HitShipObserver pObserver = new HitShipObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }

            //very wierd not sure how i feel about it
            if (pObject.GetName() == GameObject.Name.Octopus || pObject.GetName() == GameObject.Name.Squid || pObject.GetName() == GameObject.Name.Crab)
            {
                //we want to reset the grids location
                AlienGroup pGrid = (AlienGroup)GONodeMan.Find(GameObject.Name.AlienGrid);
                pGrid.MoveUp();
            }
        }
        public override void Notify()
        {
            //Debug.WriteLine("Move Right");
            Ship pShip = ShipMan.GetShip();

            pShip.MoveRight();
        }
Example #3
0
        public override void Notify()
        {
            // Debug.WriteLine("Shoot Observer");
            Ship pShip = ShipMan.GetShip();

            pShip.ShootMissile();
        }
        public override void Notify()
        {
            //Testing purposes
            //Debug.WriteLine("Move Left");
            Ship pShip = ShipMan.GetShip();

            pShip.MoveLeft();
        }
        // Data



        // Methods
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            //old way to do it
            //pShip.SetState(ShipMan.State.Ready);

            pShip.Handle();
        }
Example #6
0
        public override void Notify()
        {
            //Testing purposes
            //Debug.WriteLine("Shoot");

            //get the ship
            Ship pShip = ShipMan.GetShip();

            //tell the ship to shoot/create a missile
            pShip.ShootMissile();
        }
Example #7
0
 public override void Visit(ShipLeaf b)
 {
     if (locationY == 201)  //hit left
     {
         ShipMan.GetShip().x += Nums.ShipSpeed;
     }
     else   //hit right
     {
         ShipMan.GetShip().x -= Nums.ShipSpeed;
     }
 }
Example #8
0
        public override void Notify()
        {
            this.debouceCount++;
            //debounceLimit is a static var in InputObserver.cs
            if (this.debouceCount % debounceLimit == 1)
            {
                //Debug.WriteLine("Moving Left");
            }
            Ship pShip = ShipMan.GetShip();

            pShip.MoveLeft();
        }
        public override void Notify()
        {
            WallCategory pWall = (WallCategory)this.pSubject.pObjB;
            //Debug.WriteLine("Ship hits " + pWall.name);

            Ship pShip = ShipMan.GetShip();

            if (pWall.name == GameObject.Name.WallRight)
            {
                pShip.SetState(ShipMan.State.NotMovingRight);
            }
            else if (pWall.name == GameObject.Name.WallLeft)
            {
                pShip.SetState(ShipMan.State.NotMovingLeft);
            }
        }
Example #10
0
        public override void Notify()
        {
            // we need to revert lvl1 or lvl2 to original forms
            // because we lost and will need to re-load content

            //ship was hit take a life and subtract from score

            PlayerMan.P1TakeLife();
            PlayerMan.SetP1Score(-250);

            float P1lives = PlayerMan.GetP1Lives();

            SpaceInvaders pGame = GameMan.GetGame();

            //check if they have more lives
            if (P1lives == 0)
            {
                // last life i was stil able to shoot
                Ship pShip = ShipMan.GetShip();

                pShip.SetShootState(ShipMan.ShootState.End);
                pShip.SetMoveState(ShipMan.MoveState.NoMove);

                GameState pState = pGame.GetCurrentState();

                if (pState.GetStateName() == GameMan.State.InGame)
                {
                    InGameState pLvl1 = (InGameState)pState;
                    pLvl1.SetStateToggle(false);

                    TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f);
                }

                else if (pState.GetStateName() == GameMan.State.LVL2)
                {
                    InGameStateLV2 pLvl2 = (InGameStateLV2)pState;
                    pLvl2.SetStateToggle(false);

                    TimerMan.Add(TimeEvent.Name.GameStateChange, new GameStateChange(false), 5.0f);
                }
            }

            else
            {
                //do nothing
            }
        }
Example #11
0
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            if (this.pSubject.pObjB.GetName() == GameObject.Name.BumperRight)
            {
                pShip.SetMoveState(ShipMan.State.MoveLeft);
            }
            else if (this.pSubject.pObjB.GetName() == GameObject.Name.BumperLeft)
            {
                pShip.SetMoveState(ShipMan.State.MoveRight);
            }
            else
            {
                Debug.Assert(false);
            }
        }
Example #12
0
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.Handle();
        }
Example #13
0
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.MoveRight();
        }
        //-------------------------------------------------------------------------------
        // Override abstract methods
        //-------------------------------------------------------------------------------
        public override void notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.moveLeft();
        }
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.ShootMissile();
        }
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.SetShootState(ShipMan.ShootState.Ready);
        }
        public override void Notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.SetState(ShipMan.State.End);
        }
Example #18
0
        //----------------------------------------------------------------------
        // Override abstract class
        //----------------------------------------------------------------------
        public override void notify()
        {
            Ship pShip = ShipMan.GetShip();

            pShip.setState(ShipMan.State.Ready);
        }