Пример #1
0
        public static void CheckDeltaTime()
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            if (40 < pMan.numAliveAliens)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 1.0f);
            }
            else if (30 < pMan.numAliveAliens && pMan.numAliveAliens <= 40)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 0.7f);
            }
            else if (20 < pMan.numAliveAliens && pMan.numAliveAliens <= 30)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 0.4f);
            }
            else if (8 < pMan.numAliveAliens && pMan.numAliveAliens <= 20)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 0.2f);
            }
            else if (3 < pMan.numAliveAliens && pMan.numAliveAliens <= 8)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 0.1f);
            }
            else if (pMan.numAliveAliens <= 3)
            {
                TimerManager.SetAlienDeltaTime(pMan.originDeltaTime * 0.05f);
            }
        }
Пример #2
0
        public static AlienNode Add(GameObject pObj)
        {
            Debug.Assert(pObj != null);


            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            if (pObj.type == Component.Container.LEAF)
            {
                pMan.numAliveAliens--;
            }

            // Take a node out from Reserve list.
            // This node is washed in BasePopNode().

            AlienNode pNode = (AlienNode)pMan.BasePopNode();

            Debug.Assert(pNode != null);

            pNode.Set(pObj);
            pMan.BaseSortedAdd(pNode);
            return(pNode);
        }
Пример #3
0
        public static void OneAlienDead()
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.numAliveAliens--;
        }
Пример #4
0
        public static void ResetNumAliens()
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            pMan.numAliveAliens = 55;
        }
Пример #5
0
        public static void Remove(AlienNode pNode)
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);
            Debug.Assert(pNode != null);
            pMan.BaseRemove(pNode);
        }
Пример #6
0
        public static void ResetAllAlienGrid()
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            AlienNode     pCurr = (AlienNode)pMan.BaseGetActive();
            AlienNode     pNext;
            GameObject    pParent;
            GameObject    pObj;
            AlienCategory pAlien;

            while (pCurr != null)
            {
                pNext = (AlienNode)pCurr.pNext;

                // Get Alien object and its parent. The parent will be AlienGroup or AlienColumn.
                pObj = pCurr.GetAlienObject();

                pParent = (GameObject)pCurr.GetAlienObject().pParent;

                pObj.isDead = false;

                pObj.pPrev = null;
                pObj.pNext = null;

                pParent.Add(pObj);

                if (pObj.type == Component.Container.LEAF)
                {
                    pAlien = (AlienCategory)pObj;

                    pObj.x = pAlien.originX;
                    pObj.y = pAlien.originY;
                    SpriteBatch pSB_GameSprite = SpriteBatchManager.Find(SpriteBatch.Name.GameSprites);
                    Debug.Assert(pSB_GameSprite != null);

                    pSB_GameSprite.Attach(pObj.pProxySprite);
                    // pMan.pSB_GameSprite.Attach(pObj.pProxySprite);
                }

                SpriteBatch pSB_Collsion = SpriteBatchManager.Find(SpriteBatch.Name.BoxSprites);
                pSB_Collsion.Attach(pObj.pColObject.pBoxSprite);
                // pMan.pSB_CollisionSprite.Attach(pObj.pColObject.pBoxSprite);

                AlienManager.Remove(pCurr);

                DLink p = pMan.BaseGetActive();

                pCurr = pNext;
            }

            // Checked new Alien Hierarchy is good
            //  pMan.pSB_GameSprite.Dump();
            //  pMan.pSB_CollisionSprite.Dump();
        }
Пример #7
0
        public static void PrintMe()
        {
            AlienManager pMan = AlienManager.PrivGetInstance();

            Debug.Assert(pMan != null);

            AlienNode pNode = (AlienNode)pMan.BaseGetActive();

            while (pNode != null)
            {
                pNode.PrintMe();
                pNode = (AlienNode)pNode.pNext;
            }
        }