Exemplo n.º 1
0
        public override void Execute(float deltaTime)
        {
            int bombStyle = pRandom.Next(0, 3);

            GameObject pUFO = (GameObject)this.pGridHead.poHead;

            Bomb pBomb;

            if (pUFO.isDead == false)
            {
                switch (bombStyle)
                {
                case 0:
                    pBomb = BombManager.GetZigZagFall(pUFO.x, pUFO.y);
                    break;

                case 1:
                    pBomb = BombManager.GetStraightFall(pUFO.x, pUFO.y);
                    break;

                case 2:
                    pBomb = BombManager.GetCrossFall(pUFO.x, pUFO.y);
                    break;

                default:
                    Debug.Assert(false);
                    break;
                }
            }
            float nextDeltaTime = pRandom.Next(2, 4);

            TimerManager.Add(TimeEvent.Name.SpawnBomb, this, nextDeltaTime);
        }
Exemplo n.º 2
0
        public override void Execute(float deltaTime)
        {
            int bombStyle = pRandom.Next(0, 3);
            int numCol    = 0;

            AlienColumn pColumn = (AlienColumn)this.pGridHead.poHead;

            while (pColumn != null)
            {
                numCol++;
                pColumn = (AlienColumn)pColumn.pNext;
            }
            int col = pRandom.Next(0, numCol);

            pColumn = (AlienColumn)this.pGridHead.poHead;
            while (col > 0)
            {
                col--;
                pColumn = (AlienColumn)pColumn.pNext;
            }

            if (pColumn != null)
            {
                GameObject pAlien = (GameObject)pColumn.poLast;
                Bomb       pBomb;
                switch (bombStyle)
                {
                case 0:
                    pBomb = BombManager.GetZigZagFall(pAlien.x, pAlien.y);
                    break;

                case 1:
                    pBomb = BombManager.GetStraightFall(pAlien.x, pAlien.y);
                    break;

                case 2:
                    pBomb = BombManager.GetCrossFall(pAlien.x, pAlien.y);
                    break;

                default:
                    Debug.Assert(false);
                    break;
                }
            }

            float nextDeltaTime = pRandom.Next(5, 20);

            nextDeltaTime /= 10;
            TimerManager.Add(TimeEvent.Name.SpawnBomb, this, nextDeltaTime);
        }