示例#1
0
        public static void printList()
        {
            ProxySpriteManager spriteBoxMInstance = ProxySpriteManager.getSingletonInstance();

            Debug.Assert(proxyMInstance != null);

            Debug.WriteLine("");
            Debug.WriteLine("------ Active List: ---------------------------\n");

            MLink pNode = proxyMInstance.activeList;

            int i = 0;

            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }

            Debug.WriteLine("");
            Debug.WriteLine("------ Reserve List: ---------------------------\n");

            pNode = proxyMInstance.reserveList;
            i     = 0;
            while (pNode != null)
            {
                Debug.WriteLine("{0}: -------------", i);
                pNode.print();
                i++;
                pNode = pNode.pNext;
            }
        }
示例#2
0
 public static ProxySprite Find(ProxySprite.Name name)
 {
     ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();
     pMan.poNodeCompare.SetName(name);
     ProxySprite pData = (ProxySprite)pMan.BaseFind(pInstance.poNodeCompare);
     return pData;
 }
示例#3
0
 public static void Remove(GameSprite pNode)
 {
     ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();
     Debug.Assert(pMan != null);
     Debug.Assert(pNode != null);
     pMan.BaseRemove(pNode);
 }
示例#4
0
        public static ProxySprite Add(SpriteBaseName spriteName)
        {
            ProxySpriteManager proxySpriteMan = ProxySpriteManager.GetInstance();
            ProxySprite        proxySprite    = (ProxySprite)proxySpriteMan.BaseAdd();

            proxySprite.Set(spriteName);
            return(proxySprite);
        }
示例#5
0
        public static void Dump()
        {
            ProxySpriteManager pMan = ProxySpriteManager.GetInstance();

            Debug.Assert(pMan != null);

            pMan.BaseDump();
        }
示例#6
0
        public static void remove(ProxySprite targetNode)
        {
            ProxySpriteManager spriteBoxMInstance = ProxySpriteManager.getSingletonInstance();

            Debug.Assert(proxyMInstance != null);

            Debug.Assert(targetNode != null);
            proxyMInstance.genericRemove(targetNode);
        }
示例#7
0
        public static ProxySpriteManager getInstance()
        {
            if (pInstance == null)
            {
                pInstance = new ProxySpriteManager();
            }

            return(pInstance);
        }
示例#8
0
 public AlienGO(GameObject.Name gameName, GameSprite.Name spriteName, GameSprite.Name expSpriteName, int points, float x, float y)
     : base(gameName, spriteName)
 {
     this.x          = x;
     this.y          = y;
     this.delta      = 1.0f;
     this.points     = points;
     this.pExplosion = ProxySpriteManager.Add(expSpriteName);
 }
        public static void DumpLists()
        {
            ProxySpriteManager pMan = ProxySpriteManager.privGetInstance();

            Debug.Assert(pMan != null);

            Debug.WriteLine("------ ProxySprite Manager Lists ------");
            pMan.baseDumpLists();
        }
示例#10
0
 public static void Create(int reserveSize, int reserveIncrement)
 {
     Debug.Assert(reserveSize > 0);
     Debug.Assert(reserveIncrement > 0);
     if (pInstance == null)
     {
         pInstance = new ProxySpriteManager(reserveSize, reserveIncrement);
     }
 }
        public static void Remove(ProxySprite pSprite)
        {
            ProxySpriteManager pManager = ProxySpriteManager.privGetInstance();

            Debug.Assert(pManager != null);
            Debug.Assert(pSprite != null);

            // delegate to abstract manager who deals with the DLinks
            pManager.baseRemove(pSprite);
        }
示例#12
0
        public GameObject(GameObject.Name gameName, GameSprite.Name spriteName) : base()
        {
            this.name = gameName;
            this.x    = 0.0f;
            this.y    = 0.0f;

            this.pProxySprite = ProxySpriteManager.Add(spriteName);
            this.poCollObj    = new CollisionObj(this.pProxySprite);
            Debug.Assert(this.poCollObj != null);
            this.bMarkForDeath = false;
        }
示例#13
0
        //----------------------------------------------------------------------------------
        // Set Methods
        //----------------------------------------------------------------------------------

        public void Set(GameObject.Name gameName, GameSprite.Name spriteName, float px = 0.0f, float py = 0.0f)
        {
            this.name = gameName;
            this.x    = px;
            this.y    = py;

            this.pProxySprite = ProxySpriteManager.Add(spriteName);
            this.poCollObj    = new CollisionObj(this.pProxySprite);
            Debug.Assert(this.poCollObj != null);
            this.bMarkForDeath = false;
        }
示例#14
0
        public static void PrintReport()
        {
            Debug.WriteLine("--------------------------------------------------------------------------------");
            Debug.WriteLine("----------------------------- ProxySprite Manager ------------------------------");
            Debug.WriteLine("--------------------------------------------------------------------------------");

            ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            pMan.BasePrintReport();
        }
示例#15
0
        //SpriteNode pBackPointer;

        public ExplosionSprite(GameSprite.Name spriteName, float px, float py) : base()
        {
            // finds the ProxySprite and returns a reference to it.
            // the sprite base of the proxy sprite has a back pointer to its spritenode
            this.pProxySprite = ProxySpriteManager.Add(spriteName);

            this.pProxySprite.SetCoordinates(px, py);
            this.pProxySprite.Update();

            this.pExplosionBatch = SpriteNodeBatchManager.Find(SpriteNodeBatch.Name.Explosions);
        }
示例#16
0
 protected GameObject(GameObjectName goName, SpriteBaseName spriteName, int idx)
 {
     this.gameObjectName = goName;
     this.index          = idx;
     this.markedForDeath = false;
     this.x            = 0.0f;
     this.y            = 0.0f;
     this.pProxySprite = ProxySpriteManager.Add(spriteName);
     Debug.Assert(this.pProxySprite != null);
     this.pCollisionObject = new CollisionObject(this.pProxySprite);
     Debug.Assert(this.pCollisionObject != null);
 }
示例#17
0
 //--------------------------------------------------------------------------------------------
 // Constructor
 //--------------------------------------------------------------------------------------------
 protected GameObject(GameObject.Name gameObjectName, GameSprite.Name gameSpriteName)
 {
     this.name = gameObjectName;
     this.x = 0.0f;
     this.y = 0.0f;
     this.sx = 1.0f;
     this.sy = 1.0f;
     this.pProxySprite = ProxySpriteManager.Add(gameSpriteName);
     Debug.Assert(this.pProxySprite != null);
     this.pColObject = new CollisionObject(this.pProxySprite);
     Debug.Assert(this.pColObject != null);
     this.isDead = false;
 }
示例#18
0
        public static ProxySprite Find(ProxySprite.Name name)
        {
            ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.poCompareNode.name = name;

            ProxySprite pData = (ProxySprite)pMan.BaseFind(pMan.poCompareNode);

            Debug.Assert(pData != null);
            return(pData);
        }
示例#19
0
        protected GameObject(GameObjectName mGameObjectName, int index, Sprite.SpriteName mSpriteName)
        {
            this.cGameObjectName = mGameObjectName;
            this.x            = 0.0f;
            this.y            = 0.0f;
            this.index        = index;
            this.cProxySprite = ProxySpriteManager.add(mSpriteName);
            Debug.Assert(cProxySprite != null);

            this.cCollisionObj = new CollisionObject(cProxySprite);
            Debug.Assert(cCollisionObj != null);
            this.death = false;
        }
        public static ProxySprite Find(ProxySprite.Name theName)
        {
            ProxySpriteManager pSpriteManager = ProxySpriteManager.privGetInstance();

            Debug.Assert(pSpriteManager != null);

            // set common compare node, static object ref
            pSpriteManager.poNodeCompare.SetName(theName);

            //find and return ref
            ProxySprite pSprite = (ProxySprite)pSpriteManager.baseFind(pSpriteManager.poNodeCompare);

            return(pSprite);
        }
示例#21
0
        //---------------------------------------------------------------------------------
        // Static Methods
        //---------------------------------------------------------------------------------
        public static void Create(int reserveNum = 3, int reserveGrow = 1)
        {
            Debug.Assert(reserveNum > 0);
            Debug.Assert(reserveGrow > 0);

            // Initialize the singleton here
            Debug.Assert(pInstance == null);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new ProxySpriteManager(reserveNum, reserveGrow);
            }
        }
        //----------------------------------------------------------------------
        // Methods
        //----------------------------------------------------------------------

        public static ProxySprite Add(GameSprite.Name name)
        {
            ProxySpriteManager pMan = ProxySpriteManager.privGetInstance();

            Debug.Assert(pMan != null);
            //todo look into edge case for null game sprite name - create a null game sprite to add?
            ProxySprite pNode = (ProxySprite)pMan.baseAddToFront();

            Debug.Assert(pNode != null);

            pNode.Set(name);

            return(pNode);
        }
示例#23
0
        // TODO right now proxies are not being added to the manager
        public static ProxySprite Add(Sprite.Name name)
        {
            ProxySpriteManager pMan = ProxySpriteManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            ProxySprite pNode = (ProxySprite)pMan.BaseAdd();

            Debug.Assert(pNode != null);

            pNode.Set(name);

            return(pNode);
        }
        //----------------------------------------------------------------------------------
        //    Static Methods
        //----------------------------------------------------------------------------------
        public static void Create(int initReserve = 3, int growthRate = 1)
        {
            // pre-conditions
            Debug.Assert(initReserve > 0);
            Debug.Assert(growthRate > 0);

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

            // create the one an only instance.
            if (ProxySpriteManager.pInstance == null)
            {
                ProxySpriteManager.pInstance = new ProxySpriteManager(initReserve, growthRate);
            }
        }
示例#25
0
        public static void createMInstance(int deltaRefillCount = 3, int prefillCount = 5)
        {
            Debug.Assert(deltaRefillCount > 0);
            Debug.Assert(prefillCount > 0);
            if (proxyMInstance == null)
            {
                /// Debug.WriteLine("Created a instance of Proxy Manager");
                proxyMInstance = new ProxySpriteManager(deltaRefillCount, prefillCount);
            }
            ProxySprite pPSprite = ProxySpriteManager.add(Sprite.SpriteName.NullObject);

            Debug.Assert(pPSprite != null);
            Debug.Assert(proxyMInstance != null);
        }
示例#26
0
        public static ProxySprite add(Sprite.SpriteName mSpriteName)
        {
            ProxySpriteManager spriteBoxMInstance = ProxySpriteManager.getSingletonInstance();

            Debug.Assert(proxyMInstance != null);

            ProxySprite nodeAdded = (ProxySprite)proxyMInstance.genericAdd();

            Debug.Assert(nodeAdded != null);
            //set the attributes of the proxy sprite node

            nodeAdded.setAll(mSpriteName);
            return(nodeAdded);
        }
示例#27
0
        //-----------------------------------------------------------------------------
        // Game::UnLoadContent()
        //       unload content (resources loaded above)
        //       unload all content that was loaded before the Engine Loop started
        //-----------------------------------------------------------------------------
        public override void UnLoadContent()
        {
            TextureManager.Destroy();
            ImageManager.Destroy();

            GameSpriteManager.Destroy();
            BoxSpriteManager.Destroy();

            SpriteBatchManager.Destroy();

            ProxySpriteManager.Destroy();

            TimerEventManager.Destroy();
            DeathManager.Destroy();
        }
        public static void Destroy()
        {
            // Get the instance
            ProxySpriteManager pMan = ProxySpriteManager.privGetInstance();

            Debug.WriteLine("--->ProxySpriteManager.Destroy()");
            pMan.baseDestroy();

            #if (TRACK_DESTRUCTOR)
            Debug.WriteLine("     {0} ({1})", ProxySpriteManager.pSpriteRef, ProxySpriteManager.pSpriteRef.GetHashCode());
            Debug.WriteLine("     {0} ({1})", ProxySpriteManager.pInstance, ProxySpriteManager.pInstance.GetHashCode());
            #endif
            ProxySpriteManager.pSpriteRef = null;
            ProxySpriteManager.pInstance  = null;
        }
示例#29
0
        public static void Create(int numNodes = 10, int growthSize = 2)
        {
            // make sure values are ressonable
            Debug.Assert(numNodes > 0);
            Debug.Assert(growthSize > 0);

            // initialize the singleton here
            Debug.Assert(pInstance == null);

            // Do the initialization
            if (pInstance == null)
            {
                pInstance = new ProxySpriteManager(numNodes, growthSize);
            }
        }
        public static ProxySprite Add(GameSprite.Name theName)
        {
            ProxySpriteManager pManager = ProxySpriteManager.privGetInstance();

            Debug.Assert(pManager != null);

            //grab a DLink
            ProxySprite pSprite = (ProxySprite)pManager.baseAdd();

            Debug.Assert(pSprite != null);

            //initialize
            pSprite.Set(theName);

            return(pSprite);
        }