コード例 #1
0
        public override void notify()
        {
            Debug.WriteLine("Action after the Alien and Missile hits goes here");
            Debug.WriteLine("UFOMissileObserver Observer: {0} {1}", this.colSubject.gameObjA.cGameObjectName, this.colSubject.gameObjB.cGameObjectName);

            Missile missile = (Missile)this.colSubject.gameObjA;

            UFO ufo = (UFO)this.colSubject.gameObjB;


            missile.remove();
            ufo.explode(Sprite.SpriteName.AlienExplosion);
            //ufo.removeFromGameManager();
            //ufo.markForDeath();

            //Update Score
            PlayerManager.getCurrentPlayer().addScore(Unit.ufoScore);

            ufo.launch = false;
            UFODeathAnimation deathAni = new UFODeathAnimation(ufo);

            TimerManager.sortedAdd(TimerEvent.TimerEventName.DeathAnimation, deathAni, Unit.ufoDeathAnimationTime);

            Random      random = new Random(DateTime.UtcNow.Millisecond);
            int         number = random.Next(Unit.UFOLaunchMin, Unit.UFOLaunchMax);
            UFOActivate ufoAct = new UFOActivate(ufo);

            TimerManager.sortedAdd(TimerEvent.TimerEventName.ActivateUFO, ufoAct, number);
        }
コード例 #2
0
        public void loadUFO()
        {
            UFOFactory ufoFactory = FactoryManager.getUfoFactry();
            UFORoot    ufoRoot    = (UFORoot)ufoFactory.createUFO(UFO.UFOType.UFORoot, GameObject.GameObjectName.UFORoot, 0, 0, 0);

            ufoFactory.setParent(ufoRoot);

            UFO         ufo    = ufoFactory.createUFO(UFO.UFOType.AlienUFO, GameObject.GameObjectName.AlienUFO, 1, Unit.ufoPosX, Unit.ufoPosY);
            Random      random = new Random(DateTime.UtcNow.Millisecond);
            int         number = random.Next(1, 40);
            UFOActivate ufoAct = new UFOActivate(ufo);

            TimerManager.sortedAdd(TimerEvent.TimerEventName.ActivateUFO, ufoAct, number);
        }
コード例 #3
0
        public override void notify()
        {
            TimerManager.addDelta(delta);
            FactoryManager.getBombFactry().removeChildren();
            UFO ufo = (UFO)FactoryManager.getUfoFactry().cParent.pChild;

            if (ufo.launch)
            {
                ufo.reset();
                Random      random = new Random(DateTime.UtcNow.Millisecond);
                int         number = random.Next(1, 40);
                UFOActivate ufoAct = new UFOActivate(ufo);
                TimerManager.sortedAdd(TimerEvent.TimerEventName.ActivateUFO, ufoAct, number);
            }
            //   Game.freezeGame();
        }
コード例 #4
0
        public override void notify()
        {
            UFO ufo = null;

            if (this.colSubject.gameObjA.cGameObjectName == GameObject.GameObjectName.AlienUFO)
            {
                ufo = (UFO)this.colSubject.gameObjA;
            }
            else
            {
                ufo = (UFO)this.colSubject.gameObjB;
            }
            Random random = new Random(DateTime.UtcNow.Millisecond);
            int    number = random.Next(Unit.UFOLaunchMin, Unit.UFOLaunchMax);

            ufo.reset();
            ufo.launch = false;
            UFOActivate ufoAct = new UFOActivate(ufo);

            TimerManager.sortedAdd(TimerEvent.TimerEventName.ActivateUFO, ufoAct, number);
        }