예제 #1
0
        public override void Notify()
        {
            //when this notify is called we swap the images and draw it to the alien spritebatch
            //then maybe add a time event that..... removes it somehow... remove from spritebatch after a half second

            GameObject pObject = this.pSubject.pObjB;

            Debug.Assert(pObject != null);

            GameSprite pShipSplat = GameSpriteMan.Find(GameSprite.Name.ShipSplat);

            //future concept
            //pObject.GetProxy().SetRealSprite(this.pSprite);


            //get the locations and render the image
            //I'm really upset about this........ but here we are creating a new
            pShipSplat.PosX(pObject.x);
            pShipSplat.PosY(pObject.y);
            pShipSplat.Update();

            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);

            pSB_Aliens.Attach(pShipSplat);

            TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pShipSplat, pSB_Aliens), 0.5f);
        }
예제 #2
0
 public AnimationSprite(GameSprite.Name spriteName)
 {
     this.pSprite = GameSpriteMan.Find(spriteName);
     Debug.Assert(this.pSprite != null);
     this.pCurrImage  = null;
     this.poHeadImage = null;
 }
예제 #3
0
        public override void execute()
        {
            this.pBomb.getProxySprite().setGameSprite(GameSpriteMan.Find(GameSprite.Name.Bomb_Explosion));
            ExplosionEvent pExplosionEvent = new ExplosionEvent(this.pBomb);

            TimerMan.Add(TimeEvent.Name.ExplosionEvent, pExplosionEvent, 0.1f);
        }
예제 #4
0
        public override void Notify()
        {
            GameObject pObject = this.pSubject.pObjB;

            Debug.Assert(pObject != null);

            GameSprite pUFOSplat = GameSpriteMan.Find(GameSprite.Name.UFOsplat);

            //future concept
            //pObject.GetProxy().SetRealSprite(this.pSprite);


            //get the locations and render the image
            pUFOSplat.PosX(pObject.x);
            pUFOSplat.PosY(pObject.y);
            pUFOSplat.Update();

            SpriteBatch pSB_Aliens = SpriteBatchMan.Find(SpriteBatch.Name.Aliens);


            pSB_Aliens.Attach(pUFOSplat);


            TimerMan.Add(TimeEvent.Name.SplatAnim, new SplatAnim(pUFOSplat, pSB_Aliens), 0.5f);
        }
예제 #5
0
        public void Set(GameSprite.Name name)
        {
            this.x = 0.0f;
            this.y = 0.0f;

            this.pSprite = GameSpriteMan.Find(name);
            Debug.Assert(this.pSprite != null);
        }
예제 #6
0
        public static void Dump()
        {
            GameSpriteMan pMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.BaseDump();
        }
        public void Dump()
        {
            //GameSpriteMan pMan = GameSpriteMan.privGetInstance();
            GameSpriteMan pMan = GameSpriteMan.pActiveGSMan;

            Debug.Assert(pMan != null);

            pMan.baseDump();
        }
예제 #8
0
        public static void Remove(GameSprite pSNode)
        {
            GameSpriteMan pSMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pSMan != null);

            Debug.Assert(pSNode != null);
            pSMan.BaseRemove(pSNode);
        }
예제 #9
0
        // public
        public static void Create(int init = 2, int delta = 2)
        {
            if (pMan == null)
            {
                pMan = new GameSpriteMan(init, delta);
            }

            GameSpriteMan.Add(GameSprite.Name.Sprite_NullObject, Image.Name.Img_NullObject, 0, 0, 0, 0);
        }
예제 #10
0
        public static void Remove(GameSprite pNode)
        {
            GameSpriteMan pMan = GameSpriteMan.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemove(pNode);
        }
예제 #11
0
        public AnimateCrab(Animation.Name animName, GameSprite.Name spriteName)
            : base(animName)
        {
            this.poFirstImage  = null;
            this.pCurrentImage = null;

            this.pSprite = GameSpriteMan.Find(spriteName);
            Debug.Assert(this.pSprite != null);
        }
예제 #12
0
        //---------------------------------------------------------------------------------------------------------
        // Constructor
        //---------------------------------------------------------------------------------------------------------
        public AnimationSprite(GameSprite.Name name)
        {
            this.pGameSprite = GameSpriteMan.Find(name);
            Debug.Assert(this.pGameSprite != null);

            this.poFirstImage = null;
            this.pCurrImage   = null;
            this.poFirstSound = null;
            this.pCurrSound   = null;
        }
예제 #13
0
        private void PrivStatDump()
        {
            GameSpriteMan pSMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pSMan != null);

            Debug.WriteLine("");
            Debug.WriteLine("GameSprite Manager Stats------------------------------");
            pSMan.BaseStatDump();
        }
예제 #14
0
 public void Set(GameSprite.Name name)
 {
     this.x       = 0.0f;
     this.y       = 0.0f;
     this.sx      = 1.0f;
     this.sy      = 1.0f;
     this.name    = ProxySprite.Name.Proxy;
     this.pSprite = GameSpriteMan.Find(name);
     Debug.Assert(this.pSprite != null);
 }
        public void Remove(GameSprite pNode)
        {
            //GameSpriteMan pMan = GameSpriteMan.privGetInstance();
            GameSpriteMan pMan = GameSpriteMan.pActiveGSMan;

            Debug.Assert(pMan != null);

            Debug.Assert(pNode != null);
            pMan.baseRemove(pNode);
        }
예제 #16
0
        public static void Destroy()
        {
            GameSpriteMan pMan = GameSpriteMan.privGetInstance();

            Debug.Assert(pMan != null);

            // Do something clever here
            // track peak number of active nodes
            // print stats on destroy
            // invalidate the singleton
        }
        //----------------------------------------------------------------------
        // Static Methods
        //----------------------------------------------------------------------
        //public static void Create(int reserveNum = 3, int reserveGrow = 1)
        //{
        //    Debug.Assert(reserveNum > 0);
        //    Debug.Assert(reserveGrow > 0);

        //    Debug.Assert(pInstance == null);

        //    if (pInstance == null)
        //    {
        //        pInstance = new GameSpriteMan(reserveNum, reserveGrow);
        //    }

        //    // Add a NULL Sprite into the Manager, allows find
        //    GameSprite pGSprite = GameSpriteMan.Add(GameSprite.Name.NullObject, Image.Name.NullObject, 0, 0, 0, 0);
        //    Debug.Assert(pGSprite != null);
        //}

        public static void Create()
        {
            // initialize the singleton here
            Debug.Assert(pInstance == null);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new GameSpriteMan();
            }
        }
예제 #18
0
        public static void Remove(GameSprite pGameSprite)
        {
            //ensure call Create() first
            GameSpriteMan pMan = GameSpriteMan.GetInstance();

            Debug.Assert(pMan != null);

            // ensure pGameSprite is not null
            Debug.Assert(pGameSprite != null);
            pMan.baseRemove(pGameSprite);
        }
예제 #19
0
        public static void Remove(GameSprite.Name name)
        {
            GameSpriteMan pMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            GameSprite pNode = Find(name);

            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
예제 #20
0
 //-----------------------------------------------------------------------------
 // Game::UnLoadContent()
 //       unload content (resources loaded above)
 //       unload all content that was loaded before the Engine Loop started
 //-----------------------------------------------------------------------------
 public override void UnLoadContent()
 {
     GameObjectMan.Destory();
     ProxySpriteMan.Destory();
     TimerMan.Destory();
     SpriteBatchMan.Destory();
     GameSpriteMan.Destory();
     BoxSpriteMan.Destory();
     ImageMan.Destory();
     TextureMan.Destory();
 }
예제 #21
0
        public static GameSprite Find(GameSprite.Name name)
        {
            GameSpriteMan pSMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pSMan != null);

            pSMan.poNodeCompare.SetName(name);

            GameSprite pSNode = (GameSprite)pSMan.BaseFind(pSMan.poNodeCompare);

            return(pSNode);
        }
예제 #22
0
        public static void Destory()
        {
            //ensure call Create() first
            GameSpriteMan pMan = GameSpriteMan.GetInstance();

            Debug.Assert(pMan != null);

            pMan.baseDestory();

            pMan.poNodeForCompare   = null;
            GameSpriteMan.pInstance = null;
        }
예제 #23
0
        public static GameSprite Find(GameSprite.Name name)
        {
            //ensure call Create() first
            GameSpriteMan pMan = GameSpriteMan.GetInstance();

            Debug.Assert(pMan != null);

            pMan.poNodeForCompare.setName(name);
            GameSprite pData = (GameSprite)pMan.baseFind(pMan.poNodeForCompare);

            return(pData);
        }
예제 #24
0
        public static GameSprite Find(GameSprite.Name name)
        {
            GameSpriteMan pMan = GameSpriteMan.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.poNodeCompare.name = name;

            GameSprite pData = (GameSprite)pMan.BaseFind(pMan.poNodeCompare);

            return(pData);
        }
        public BlueAlienAnimationCommand(GameSprite.Name spriteName)
        {
            // initialized the sprite animation is attached to
            this.pSprite = GameSpriteMan.Find(spriteName);
            Debug.Assert(this.pSprite != null);

            // initialize references
            this.pCurrImage = null;

            // list
            this.poFirstImage = null;
        }
        public static void SetActive(GameSpriteMan pGSMan)
        {
            GameSpriteMan pMan = GameSpriteMan.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.Assert(pGSMan != null);
            GameSpriteMan.pActiveGSMan = pGSMan;

            // Add a NULL Sprite into the Manager, allows find
            GameSprite pGSprite = GameSpriteMan.Add(GameSprite.Name.NullObject, Image.Name.NullObject, 0, 0, 0, 0);

            Debug.Assert(pGSprite != null);
        }
예제 #27
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();
        }
예제 #28
0
        public static void Create(int reserveNum, int growth)
        {
            Debug.Assert(reserveNum > 0);
            Debug.Assert(growth > 0);
            Debug.Assert(pInstance == null);

            if (pInstance == null)
            {
                pInstance = new GameSpriteMan(reserveNum, growth);
            }

            GameSprite pGSprite = GameSpriteMan.Add(GameSprite.Name.NullObject, Image.Name.NullObject, 0, 0, 0, 0);

            Debug.Assert(pGSprite != null);
        }
        public static void Destroy()
        {
            //GameSpriteMan pMan = GameSpriteMan.privGetInstance();
            GameSpriteMan pMan = GameSpriteMan.pActiveGSMan;

            Debug.Assert(pMan != null);

            // Print stats on destroy
            pMan.baseDump();

            // Invalidate the singleton
            if (pInstance != null)
            {
                pInstance = null;
            }
        }
예제 #30
0
        public static GameSprite Find(GameSprite.Name name)
        {
            GameSpriteMan pMan = GameSpriteMan.privGetInstance();

            Debug.Assert(pMan != null);

            // Compare functions only compares two Nodes

            // So:  Use the Compare Node - as a reference
            //      use in the Compare() function
            pMan.poNodeCompare.SetName(name);

            GameSprite pData = (GameSprite)pMan.baseFind(pMan.poNodeCompare);

            return(pData);
        }