//----------------------------------------------------------------------------- // Game::LoadContent() // Allows you to load all content needed for your engine, // such as objects, graphics, etc. //----------------------------------------------------------------------------- public override void LoadContent() { SceneMan.Create(); Scene pScene = SceneMan.GetScene(); pScene.LoadContent(); }
public static void ChangeSceneInternal(GameObject pGameObject) { ForwardIterator pFor = new ForwardIterator(pGameObject); Component pNode = pFor.First(); pFor.Next(); if (pFor.IsDone()) { GameObject pUFORoot = GameObjectMan.Find(GameObject.Name.UFORoot); UFO pUFO = (UFO)Iterator.GetChild(pUFORoot); pUFO.StopSound(); int mode = SceneStateGame.GetPlayMode(); int currLevel = SceneStateGame.GetCurrLevel(); String pScore1 = Int32.Parse(FontMan.Find(Font.Name.Score1).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScore1(pScore1); String pScore2 = Int32.Parse(FontMan.Find(Font.Name.Score2).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScore2(pScore2); String pScoreHigh = Int32.Parse(FontMan.Find(Font.Name.ScoreHigh).GetMessage()).ToString().PadLeft(4, '0'); SceneStateGame.SetScoreHigh(pScoreHigh); SceneStateGame.SetStay(true); int currPlayer = SceneStateGame.GetCurrPlayer(); if (currLevel == 1) { SceneStateGame.SetPlayerLevel(currPlayer, 2); SceneStateGame.SetBaseY(450.0f); SceneStateGame.SetMoveRate(1.0f); } else { SceneStateGame.SetPlayerLevel(currPlayer, 1); SceneStateGame.SetBaseY(600.0f); SceneStateGame.SetMoveRate(1.5f); //no need to change to the next player, when finish level 2, same player, back to level 1 //SceneStateGame.SetCurrPlayer(currPlayer == mode ? 1 : 2); } //currLevel = SceneStateGame.GetCurrLevel(); //if (currLevel == 1) //{ // SceneStateGame.SetBaseY(600.0f); // SceneStateGame.SetMoveRate(1.5f); //} //else //{ // SceneStateGame.SetBaseY(450.0f); // SceneStateGame.SetMoveRate(1.0f); //} Scene pScene = SceneMan.GetScene(); pScene.Unload(); } }
// state() override public void Handle() { Scene pScene = SceneMan.GetScene(); pScene.SetState(SceneMan.State.Tract); pScene.LoadContent(); }
public override void Notify() { Scene pScene = SceneMan.GetScene(); pScene.Unload(); SceneStateGame.SetPlayMode(this.mode); }
//----------------------------------------------------------------------------- // 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() { // draw all objects Scene pScene = SceneMan.GetScene(); pScene.Draw(); }
public override void notify() { Scene pScene = SceneMan.GetScene(); pScene.unLoadContent(); pScene.setState(SceneMan.State.GameScene); pScene.loadContent(); }
// state() override public void Handle() { Scene pScene = SceneMan.GetScene(); pScene.SetState(SceneMan.State.Game); SceneStateGame.Reset(); pScene.LoadContent(); }
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(); }
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); }
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() { 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()); }
//----------------------------------------------------------------------------- // 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(); }
//----------------------------------------------------------------------------- // 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(); }
//----------------------------------------------------------------------------- // 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()); }
//----------------------------------------------------------------------------- // 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()); }