public override void Notify()
        {
            String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString();

            SceneStateTract.SetScoreHigh(pScoreHigh);

            Scene pScene = SceneMan.GetScene();

            pScene.Unload();
        }
        // state()
        override public void Handle()
        {
            Scene pScene = SceneMan.GetScene();

            if (pStay == false)
            {
                pScene.SetState(SceneMan.State.Gameover);
            }

            pScene.LoadContent();
        }
Exemple #3
0
        public static Scene ActivateScene()
        {
            //ensure call Create() first
            SceneMan pSceneMan = SceneMan.GetInstance();

            Debug.Assert(pSceneMan != null);

            pSceneMan.pScene = new Scene();

            return(pSceneMan.pScene);
        }
Exemple #4
0
        private static Scene ActivateScene()
        {
            SceneMan pSceneMan = SceneMan.PrivInstance();

            Debug.Assert(pSceneMan != null);

            Scene pScene = new Scene();

            pSceneMan.pScene = pScene;

            return(pSceneMan.pScene);
        }
Exemple #5
0
        public static void Create()
        {
            Debug.Assert(pInstance == null);

            if (pInstance == null)
            {
                pInstance = new SceneMan();
            }

            Debug.Assert(pInstance != null);

            pInstance.pScene = ActivateScene();
            pInstance.pScene.setState(SceneMan.State.SelectScene);
        }
Exemple #6
0
        public override void execute()
        {
            //GameObject pA = (GameObject)this.pAlien;

            //GameObject pB = (GameObject)Iterator.GetParent(pA);
            //pA.remove();

            //if (checkParent(pB) == true)
            //{
            //    GameObject pC = (GameObject)Iterator.GetParent(pB);
            //    pB.remove();
            //}

            //pA.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Alien_Explosion));
            //GameObjectMan.Find(GameObject.Name.ExplosionGroup).add(pA);
            //SpriteBatchMan.Find(SpriteBatch.Name.Explosions).attach(pA.getProxySprite());
            //pA.activateCollisionSprite(SpriteBatchMan.Find(SpriteBatch.Name.Boxes));

            GameSprite pGameSprite = this.pAlien.getProxySprite().getGameSprite();
            Scene      pScene      = SceneMan.GetScene();

            if (pGameSprite.getName() == GameSprite.Name.Squid)
            {
                pScene.addScoreOne(30);
            }
            else if (pGameSprite.getName() == GameSprite.Name.Crab)
            {
                pScene.addScoreOne(20);
            }
            else if (pGameSprite.getName() == GameSprite.Name.Octopus)
            {
                pScene.addScoreOne(10);
            }

            FontMan.Find(Font.Name.ScoreOne).updateMessage(pScene.getScoreOne().ToString("D4"));

            if (pScene.getScoreOne() > pScene.getHighestScore())
            {
                pScene.setHighstScore(pScene.getScoreOne());
                FontMan.Find(Font.Name.HighestScore).updateMessage(pScene.getHighestScore().ToString("D4"));
            }

            this.pAlien.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Alien_Explosion));
            ExplosionEvent pExplosionEvent = new ExplosionEvent(this.pAlien);

            TimerMan.Add(TimeEvent.Name.ExplosionEvent, pExplosionEvent, 0.1f);
        }
Exemple #7
0
        public static void Create()
        {
            // make sure its the first time
            Debug.Assert(instance == null);

            // Do the initialization
            if (instance == null)
            {
                instance = new SceneMan();
            }

            Debug.Assert(instance != null);

            // Stuff to initialize after the instance was created
            instance.pScene = ActivateScene();
            instance.pScene.SetState(SceneMan.State.Tract);
        }
        public override void execute(float deltaTime)
        {
            this.remainTime -= deltaTime;

            if (this.remainTime > 0)
            {
                // get next image
                ImageHolder pImageHolder = (ImageHolder)this.pCurrImage.pNext;

                // if at the end of the list, set first image back
                if (pImageHolder == null)
                {
                    pImageHolder = (ImageHolder)this.poFirstImage;
                }

                this.pCurrImage = pImageHolder;

                // change image
                this.pGameObject.getProxySprite().getGameSprite().swapImage(pImageHolder.getImage());

                // Add itself back to TimerMan
                TimerMan.Add(TimeEvent.Name.ExplosionEvent, this, deltaTime);
            }
            else
            {
                Ship pShip = (Ship)this.pGameObject;
                pShip.reduceLife();
                if (pShip.getLife() < 0)
                {
                    pShip.remove();
                    Scene pScene = SceneMan.GetScene();
                    pScene.unLoadContent();
                    pScene.setState(SceneMan.State.GameOverScene);
                    pScene.loadContent();
                }
                else
                {
                    pShip.setState(ShipMan.State.Ready);
                    pShip.setPositionState(ShipMan.State.Normal);
                    pShip.bMarkForDeath = false;
                    pShip.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Ship));
                }
            }
        }
        public override void Execute()
        {
            // Let the gameObject deal with this...
            GameObject pA = (GameObject)this.pAlien;
            GameObject pB = (GameObject)Iterator.GetParent(pA);

            pA.Remove();

            // TODO: Need a better way...
            if (PrivCheckParent(pB) == true)
            {
                GameObject pC = (GameObject)Iterator.GetParent(pB);
                pB.Remove();

                if (PrivCheckParent(pC) == true)
                {
                    SceneMan.ChangeSceneInternal(pC);
                }
            }
        }
        public override void Execute()
        {
            GameObject pUFORoot = GameObjectMan.Find(GameObject.Name.UFORoot);
            UFO        pUFO     = (UFO)Iterator.GetChild(pUFORoot);

            pUFO.StopSound();

            String pScore1    = Int32.Parse(FontMan.Find(Font.Name.Score1).GetMessage()).ToString().PadLeft(4, '0');
            String pScore2    = Int32.Parse(FontMan.Find(Font.Name.Score2).GetMessage()).ToString().PadLeft(4, '0');
            String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString().PadLeft(4, '0');

            if (this.state == false)
            {
                SceneStateGameover.SetScore1(pScore1);
                SceneStateGameover.SetScore2(pScore2);
                SceneStateGameover.SetScoreHigh(pScoreHigh);
            }

            SceneStateGame.SetScore1(pScore1);
            SceneStateGame.SetScore2(pScore2);
            SceneStateGame.SetScoreHigh(pScoreHigh);

            GameObjectNode pGhostGameObj = GhostGameObjectMan.Find(GameObject.Name.AlienGroup);

            if (pGhostGameObj != null)
            {
                SceneStateGame.SetLoadGhost(true);
            }

            GameObject pGameObj = GameObjectMan.Find(GameObject.Name.AlienGroup);

            GhostGameObjectMan.Attach(pGameObj);

            SceneStateGame.SetStay(this.state);
            Scene pScene = SceneMan.GetScene();

            pScene.Unload();
        }
        public override void execute()
        {
            Scene pScene = SceneMan.GetScene();

            pScene.addScoreOne(200);

            FontMan.Find(Font.Name.ScoreOne).updateMessage(pScene.getScoreOne().ToString("D4"));

            if (pScene.getScoreOne() > pScene.getHighestScore())
            {
                pScene.setHighstScore(pScene.getScoreOne());
                FontMan.Find(Font.Name.HighestScore).updateMessage(pScene.getHighestScore().ToString("D4"));
            }

            this.pUFO.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.UFO_Explosion));
            ExplosionEvent pExplosionEvent = new ExplosionEvent(this.pUFO);

            TimerMan.Add(TimeEvent.Name.ExplosionEvent, pExplosionEvent, 0.1f);

            UFOEvent pUFOEvent = new UFOEvent();

            TimerMan.Add(TimeEvent.Name.MovementAnimation, pUFOEvent, UFOMan.getDeltaTime());
        }
Exemple #12
0
        //-----------------------------------------------------------------------------
        // Game::Update()
        //      Called once per frame, update data, tranformations, etc
        //      Use this function to control process order
        //      Input, AI, Physics, Animation, and Graphics
        //-----------------------------------------------------------------------------
        public override void Update()
        {
            Scene pScene = SceneMan.GetScene();

            pScene.Update(this.GetTime());
        }
Exemple #13
0
        //-----------------------------------------------------------------------------
        // Game::LoadContent()
        //		Allows you to load all content needed for your engine,
        //	    such as objects, graphics, etc.
        //-----------------------------------------------------------------------------
        public override void LoadContent()
        {
            //---------------------------------------------------------------------------------------------------------
            // Manager initialization
            //---------------------------------------------------------------------------------------------------------
            ManagerFactory managerFactory = new ManagerFactory();

            managerFactory.create(Manager.Name.SceneMan);
            managerFactory.create(Manager.Name.TextureMan);
            managerFactory.create(Manager.Name.ImageMan);
            managerFactory.create(Manager.Name.GameSpriteMan);
            managerFactory.create(Manager.Name.BoxSpriteMan);
            managerFactory.create(Manager.Name.SpriteBatchMan);
            managerFactory.create(Manager.Name.TimerMan);
            managerFactory.create(Manager.Name.ProxySpriteMan, 10, 1);
            managerFactory.create(Manager.Name.GameObjectMan);
            managerFactory.create(Manager.Name.CollisionPairMan);
            managerFactory.create(Manager.Name.SoundMan);
            managerFactory.create(Manager.Name.GlyphMan);
            managerFactory.create(Manager.Name.FontMan);
            managerFactory.create(Manager.Name.UFOMan);
            managerFactory.create(Manager.Name.BombMan);
            managerFactory.create(Manager.Name.AlienMan);
            managerFactory.create(Manager.Name.ShipMan);

            //---------------------------------------------------------------------------------------------------------
            // Load the Textures
            //---------------------------------------------------------------------------------------------------------
            TextureFactory textureFactory = new TextureFactory();

            textureFactory.create(Texture.Name.SpaceInvaders, "SpaceInvaders.tga");
            textureFactory.create(Texture.Name.Shields, "Birds_N_Shield.tga");
            textureFactory.create(Texture.Name.Consolas36pt, "Consolas36pt.tga");

            FontMan.AddXml(Glyph.Name.Consolas36pt, "Consolas36pt.xml", Texture.Name.Consolas36pt);

            //---------------------------------------------------------------------------------------------------------
            // Create Images
            //---------------------------------------------------------------------------------------------------------
            ImageFactory imageFactory = new ImageFactory();

            imageFactory.create(Image.Name.Octopus);
            imageFactory.create(Image.Name.OctopusMovement);
            imageFactory.create(Image.Name.Crab);
            imageFactory.create(Image.Name.CrabMovement);
            imageFactory.create(Image.Name.Squid);
            imageFactory.create(Image.Name.SquidMovement);
            imageFactory.create(Image.Name.Missile);
            imageFactory.create(Image.Name.Ship);
            imageFactory.create(Image.Name.Brick);
            imageFactory.create(Image.Name.BrickLeft_Top0);
            imageFactory.create(Image.Name.BrickLeft_Top1);
            imageFactory.create(Image.Name.BrickLeft_Bottom);
            imageFactory.create(Image.Name.BrickRight_Top0);
            imageFactory.create(Image.Name.BrickRight_Top1);
            imageFactory.create(Image.Name.BrickRight_Bottom);
            imageFactory.create(Image.Name.BombStraight);
            imageFactory.create(Image.Name.BombZigZag);
            imageFactory.create(Image.Name.BombCross);
            imageFactory.create(Image.Name.Ship_Explosion1);
            imageFactory.create(Image.Name.Ship_Explosion2);
            imageFactory.create(Image.Name.Missile_Explosion);
            imageFactory.create(Image.Name.Alien_Explosion);
            imageFactory.create(Image.Name.UFO_Explosion);
            imageFactory.create(Image.Name.Bomb_Explosion);
            imageFactory.create(Image.Name.UFO);

            //---------------------------------------------------------------------------------------------------------
            // Create Sprites
            //---------------------------------------------------------------------------------------------------------
            SpriteFactory spriteFactory = new SpriteFactory();

            spriteFactory.create(GameSprite.Name.Squid, 40, 40, new Azul.Color(1, 1, 1));
            spriteFactory.create(GameSprite.Name.Crab, 40, 40, new Azul.Color(1, 1, 1));
            spriteFactory.create(GameSprite.Name.Octopus, 40, 40, new Azul.Color(1, 1, 1));
            spriteFactory.create(GameSprite.Name.Missile, 5, 25, new Azul.Color(1, 1, 1));
            spriteFactory.create(GameSprite.Name.Ship, 50, 25, new Azul.Color(1, 0, 1));

            spriteFactory.create(GameSprite.Name.Brick, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_LeftTop0, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_LeftTop1, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_LeftBottom, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_RightTop0, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_RightTop1, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Brick_RightBottom, 10, 10, new Azul.Color(0, 1, 0));

            spriteFactory.create(GameSprite.Name.BombZigZag, 8, 32, new Azul.Color(1, 1, 0));
            spriteFactory.create(GameSprite.Name.BombStraight, 8, 32, new Azul.Color(1, 1, 0));
            spriteFactory.create(GameSprite.Name.BombDagger, 8, 32, new Azul.Color(1, 1, 0));


            spriteFactory.create(GameSprite.Name.Ship_Explosion1, 50, 25, new Azul.Color(1, 0, 1));
            spriteFactory.create(GameSprite.Name.Ship_Explosion2, 50, 25, new Azul.Color(1, 0, 1));
            spriteFactory.create(GameSprite.Name.Missile_Explosion, 10, 10, new Azul.Color(0, 1, 0));
            spriteFactory.create(GameSprite.Name.Alien_Explosion, 40, 40, new Azul.Color(1, 1, 1));
            spriteFactory.create(GameSprite.Name.UFO_Explosion, 50, 30, new Azul.Color(1, 0, 1));
            spriteFactory.create(GameSprite.Name.Bomb_Explosion, 8, 32, new Azul.Color(1, 0, 1));

            spriteFactory.create(GameSprite.Name.UFO, 50, 30, new Azul.Color(1, 0, 1));

            SceneMan.GetScene().loadContent();
        }
Exemple #14
0
 //-----------------------------------------------------------------------------
 // Game::Draw()
 //		This function is called once per frame
 //	    Use this for draw graphics to the screen.
 //      Only do rendering here
 //-----------------------------------------------------------------------------
 public override void Draw()
 {
     SceneMan.GetScene().draw();
 }
Exemple #15
0
 //-----------------------------------------------------------------------------
 // Game::Update()
 //      Called once per frame, update data, tranformations, etc
 //      Use this function to control process order
 //      Input, AI, Physics, Animation, and Graphics
 //-----------------------------------------------------------------------------
 public override void Update()
 {
     SceneMan.GetScene().update(this.GetTime());
 }
Exemple #16
0
 public void SetState(SceneMan.State inState)
 {
     this.state = SceneMan.GetState(inState);
 }
        //-------------------------------------------------------------------------------
        // Methods
        //-------------------------------------------------------------------------------
        public void create(Manager.Name managerName, int reserveNum = 3, int growNum = 1)
        {
            switch (managerName)
            {
            case Manager.Name.TextureMan:
                TextureMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.ImageMan:
                ImageMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.GameSpriteMan:
                GameSpriteMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.BoxSpriteMan:
                BoxSpriteMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.SpriteBatchMan:
                SpriteBatchMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.TimerMan:
                TimerMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.ProxySpriteMan:
                ProxySpriteMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.GameObjectMan:
                GameObjectMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.CollisionPairMan:
                CollisionPairMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.GlyphMan:
                GlyphMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.FontMan:
                FontMan.Create(reserveNum, growNum);
                break;

            case Manager.Name.ShipMan:
                ShipMan.Create();
                break;

            case Manager.Name.BombMan:
                BombMan.Create();
                break;

            case Manager.Name.SoundMan:
                SoundMan.Create();
                break;

            case Manager.Name.AlienMan:
                AlienMan.Create();
                break;

            case Manager.Name.UFOMan:
                UFOMan.Create();
                break;

            case Manager.Name.SceneMan:
                SceneMan.Create();
                break;

            default:
                Debug.Assert(false);
                break;
            }
        }
Exemple #18
0
 public void setState(SceneMan.State state)
 {
     this.state = SceneMan.GetState(state);
 }