Beispiel #1
0
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            // At this point we have two game objects
            // Actually we can control the objects in the visitor
            // Alphabetical ordering... A is missile,  B is wall

            // This cast will throw an exception if I'm wrong
            this.pBomb = (Bomb)this.pSubject.pObjA;
            this.pSubB = this.pSubject.pObjB;

            //Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pBomb);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;

                // Delay - remove object later
                // TODO - reduce the new functions
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectManager.Attach(pObserver);
            }

            //this.pBomb.pOwner.Handle();
        }
Beispiel #2
0
        public override void Notify()
        {
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }

            if (this.pSubject.pObjB is WallBottom)
            {
                //---------------------------------------------------------------------------------------------------------
                // Explosion
                //---------------------------------------------------------------------------------------------------------
                Explosion   explosion  = new Explosion(GameObject.Name.Explosion_Ground, GameSprite.Name.Explosion_Ground, this.pBomb.x, this.pBomb.y);
                SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);
                explosion.ActivateGameSprite(pSB_Aliens);
                GameObjectMan.Attach(explosion);
                TimerMan.Add(TimeEvent.Name.RemoveExplosion, new RemoveExplosionCommand(explosion), 0.25f);
            }
        }
Beispiel #3
0
 public RemoveBombObserver(RemoveBombObserver m)
 {
     Debug.Assert(m.pBomb != null);
     Debug.Assert(m.pSubB != null);
     this.pBomb  = m.pBomb;
     this.pEvent = new RemoveBombEvent();
     this.pSubB  = m.pSubB;
 }
Beispiel #4
0
        public override void Notify()
        {
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
        public override void Notify()
        {   //delete bomb
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
Beispiel #6
0
        public override void Update()
        {
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);

            //this.pBomb = (Bomb)this.pSubject.goA;
            this.pBomb = Bomb.GetBomb(this.pSubject.goA, this.pSubject.goB);
            Debug.Assert(this.pBomb != null);
            //Debug.WriteLine("BombRemoveObserver: --> delete bomb {0}", pBomb);
            if (pBomb.markedForDeath == false)
            {
                pBomb.markedForDeath = true;
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
Beispiel #7
0
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);

            if (pBomb.bMarkForDeath == false)
            {
                pBomb.bMarkForDeath = true;
                //   Delay
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
        public override void Notify()
        {
            // Delete missile
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            //this.pBomb = BombCategory.GetBomb(this.pSubject.pObjA, this.pSubject.pObjB);
            this.pBomb = (Bomb)this.pSubject.pObjA;
            Debug.Assert(this.pBomb != null);
            //Debug.WriteLine("RemoveBombObserver: --> delete bomb {0}", pBomb);

            if (pBomb.markForDeath == false)
            {
                pBomb.markForDeath = true;
                //   Delay

                //todo replace this new with a find from object pool;
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectManager.Attach(pObserver);
            }
        }
        protected override void derivedUpdate(ColSubject pColSubject)
        {
            //Debug.WriteLine(this.GetHashCode() + " RemoveBombObserver: {0} vs {1}", pColSubject.pObjA.name, pColSubject.pObjB.name);
            // Bomb will always be pObjB
            GameObject pGameObjA = pColSubject.pObjA;
            GameObject pGameObjB = pColSubject.pObjB;

            Debug.Assert(pGameObjA != null);
            Debug.Assert(pGameObjB != null);

            if (pGameObjA.name == GameObject.Name.Bomb)
            {
                this.pBomb = (Bomb)pGameObjA;
            }
            else if (pGameObjB.name == GameObject.Name.Bomb)
            {
                this.pBomb = (Bomb)pGameObjB;
            }
            else
            {
                Debug.Assert(false, "Neither of the objects are Bombs");
            }


            //Debug.WriteLine("Set state of Invader to true" + this.pBomb.pInvaderWhoDroppedMe);
            if (this.pBomb.bMarkForDeath == false)
            {
                this.pBomb.pInvaderWhoDroppedMe.canLaunchBomb = true;
                pBomb.bMarkForDeath = true;

                OneTimeAnimation pDeathAnimation = new OneTimeAnimation(Sprite.Name.BombDeath, this.pBomb.x, this.pBomb.y);
                pDeathAnimation.Attach(Image.Name.BombDeath);
                TimerManager.Add(TimeEvent.Name.InvaderDeath, pDeathAnimation, 0.1f);

                // Delay - remove object later
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                DelayedObjectManager.Attach(pObserver);
            }
        }
Beispiel #10
0
        public override void Notify()
        {
            //Debug.WriteLine("RemoveBombObserver: {0} {1}", this.pSubject.pObjA, this.pSubject.pObjB);

            if ((this.pSubject.pObjA.GetType() == typeof(Bomb)) ||
                (this.pSubject.pObjA.GetType() == typeof(FlyingSaucerBomb)))
            {
                this.pBomb = (Bomb)this.pSubject.pObjA;
            }
            else
            {
                this.pBomb = (Bomb)this.pSubject.pObjB;
            }


            if (!pBomb.IsMarkedForDeath())
            {
                pBomb.MarkForDeath();

                // Delay - remove object later
                RemoveBombObserver pObserver = new RemoveBombObserver(this);
                GameStateManager.GetGame().GetStateDelayedObjectManager().Attach(pObserver);
            }
        }
Beispiel #11
0
 public RemoveBombObserver(RemoveBombObserver m)
 {
     Debug.Assert(m.pBomb != null);
     this.pBomb = m.pBomb;
 }
Beispiel #12
0
        public RemoveBombObserver(RemoveBombObserver b)
        {
            this.pBomb = b.pBomb;

            this.scenePlay = b.scenePlay;
        }
 public RemoveBombObserver(RemoveBombObserver b)
 {
     this.pBomb = b.pBomb;
 }
 public RemoveBombObserver(RemoveBombObserver bm)
 {
     this.pBomb = bm.pBomb;
 }
 public RemoveBombObserver(RemoveBombObserver b, SpriteBatchMan pSpriteBatchMan)
 {
     Debug.Assert(b != null);
     this.pBomb           = b.pBomb;
     this.pSpriteBatchMan = pSpriteBatchMan;
 }
 public RemoveBombObserver(RemoveBombObserver pRBbserver)
 {
     this.pBomb = pRBbserver.pBomb;
 }
Beispiel #17
0
 public RemoveBombObserver(RemoveBombObserver b)
 {
     Debug.Assert(b != null);
     this.pBomb = b.pBomb;
 }
Beispiel #18
0
 public RemoveBombObserver(RemoveBombObserver observer)
 {
     this.pBomb = observer.pBomb;
 }