コード例 #1
0
        //----------------------------------------------------------------------
        // Override abstract class
        //----------------------------------------------------------------------
        public override void notify()
        {
            //Debug.WriteLine("Ship_Observer: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);
            Ship         pShip = (Ship)this.pSubject.pObjA;
            BumpCategory pBump = (BumpCategory)this.pSubject.pObjB;

            if (pBump.GetCategoryType() == BumpCategory.Type.Left)
            {
                pShip.setPositionState(ShipMan.State.MostLeft);
            }
            else if (pBump.GetCategoryType() == BumpCategory.Type.Right)
            {
                pShip.setPositionState(ShipMan.State.MostRight);
            }
            else
            {
                Debug.Assert(false);
            }
        }
コード例 #2
0
        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();
        }
コード例 #3
0
        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));
                }
            }
        }
コード例 #4
0
 //---------------------------------------------------------
 // Override abstract methods
 //---------------------------------------------------------
 public override void handle(Ship pShip)
 {
     pShip.setPositionState(ShipMan.State.Normal);
 }