public override void execute() { Ship pRealShip = (Ship)this.pShip; pRealShip.setState(ShipMan.State.End); pRealShip.setPositionState(ShipMan.State.Stay); pRealShip.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Ship_Explosion1)); AnimationExplosion pAnimExplosion = new AnimationExplosion(pRealShip, 1.0f); pAnimExplosion.attach(Image.Name.Ship_Explosion2); pAnimExplosion.attach(Image.Name.Ship_Explosion1); TimerMan.Add(TimeEvent.Name.ExplosionEvent, pAnimExplosion, 0.3f); //this.pShip.remove(); }
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)); } } }
//--------------------------------------------------------- // Override abstract methods //--------------------------------------------------------- public override void handle(Ship pShip) { pShip.setState(ShipMan.State.MissileFlying); }
//---------------------------------------------------------------------- // Override abstract class //---------------------------------------------------------------------- public override void notify() { Ship pShip = ShipMan.GetShip(); pShip.setState(ShipMan.State.Ready); }