protected override void derivedUpdate(ColSubject pColSubject)
        {
            //Debug.WriteLine("ShipRemoveMissileObserver: {0} vs {1}", pColSubject.pObjA.name, pColSubject.pObjB.name);
            // Missle will always be pObjA
            GameObject pGameObjA = pColSubject.pObjA;
            GameObject pGameObjB = pColSubject.pObjB;

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

            Missile pMissile = null;

            if (pGameObjA.name == GameObject.Name.Missle)
            {
                pMissile = (Missile)pGameObjA;
            }
            else if (pGameObjB.name == GameObject.Name.Missle)
            {
                pMissile = (Missile)pGameObjB;
            }
            else
            {
                Debug.Assert(false, "Neither of the objects are Missle");
            }

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

                // Delay - remove object later
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver();
                DelayedObjectManager.Attach(pObserver);
            }
        }
Ejemplo n.º 2
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.pMissile = (Missile)this.pSubject.pObjA;

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


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

                // Delay - remove object later
                // ToDo - reduce the new functions
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this, pSpriteBatchMan);
                DelayedObjectMan.Attach(pObserver);
            }
        }
 public ShipRemoveMissileObserver(ShipRemoveMissileObserver m)
 {
     Debug.Assert(m.pMissile != null);
     this.pMissile = m.pMissile;
     this.pEvent   = new ResetMissileEvent();
     this.pSubB    = m.pSubB;
 }
Ejemplo n.º 4
0
        public override void Update()
        {
            Debug.WriteLine("ShipRemoveMissileObserver: {0} {1}", this.pSubject.goA, this.pSubject.goB);

            this.pMissile = Missile.GetMissile(this.pSubject.goA, this.pSubject.goB);
            Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile);
            if (pMissile.markedForDeath == false)
            {
                pMissile.markedForDeath = true;
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this);
                DelayedGameObjectManager.Attach(pObserver);
            }
        }
        public ShipRemoveMissileObserver(ShipRemoveMissileObserver m)
        {
            Debug.Assert(m.pMissile != null);
            this.pMissile = m.pMissile;

            this.pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);
            Debug.Assert(this.pSB_Aliens != null);

            this.pSB_Boxes = SpriteBatchMan.Find(SpriteBatch.Name.Boxes);
            Debug.Assert(this.pSB_Boxes != null);

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

            this.pMissile = MissileCategory.GetMissile(this.pSubject.pObjA, this.pSubject.pObjB);
            Debug.WriteLine("MissileRemoveObserver: --> delete missile {0}", pMissile);

            if (pMissile.markForDeath == false)
            {
                pMissile.markForDeath = true;
                //   Delay
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this);
                DelayedObjectManager.Attach(pObserver);
            }
        }
        public override void Notify()
        {
            // 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.pMissile = (Missile)this.pSubject.pObjA;

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

                // Delay - remove object later
                // TODO - reduce the new functions
                ShipRemoveMissileObserver pObserver = new ShipRemoveMissileObserver(this);
                DelayedObjectMan.Attach(pObserver);
            }
        }
Ejemplo n.º 8
0
 public ShipRemoveMissileObserver(ShipRemoveMissileObserver m, SpriteBatchMan pSpriteBatchMan)
 {
     Debug.Assert(m.pMissile != null);
     this.pMissile        = m.pMissile;
     this.pSpriteBatchMan = pSpriteBatchMan;
 }
 public ShipRemoveMissileObserver(ShipRemoveMissileObserver m)
 {
     this.pMissile = m.pMissile;
 }
Ejemplo n.º 10
0
 public ShipRemoveMissileObserver(ShipRemoveMissileObserver observer)
 {
     this.pMissile = observer.pMissile;
 }
 public ShipRemoveMissileObserver(ShipRemoveMissileObserver m)
 {
     Debug.Assert(m.pMissile != null);
     this.pMissile = m.pMissile;
 }