Esempio n. 1
0
        void moveTriad()
        {
            try
            {
                if (triad == null)
                {
                    return;
                }

                timeNow = Timer.TicksElapsed;
                triad.Update();

                int deltaTime          = timeNow - lastTriadMove;
                int deltaTimeLeftRight = timeNow - lastTriadLeftRight;

                if ((this.moveTriadLeft == true) && (deltaTimeLeftRight > 250))
                {
                    triad.MoveLeft();
                    this.lastTriadLeftRight = Timer.TicksElapsed;
                    moveSound.Play();
                }

                if ((this.moveTriadRight == true) && (deltaTimeLeftRight > 250))
                {
                    triad.MoveRight();
                    this.lastTriadLeftRight = Timer.TicksElapsed;
                    moveSound.Play();
                }

                if ((deltaTime > delayFactor) || ((rapidDropTriad) && (deltaTime > (delayFactor / 16))))
                {
                    if (triad.CanMoveDown())
                    {
                        triad.MoveDown();
                    }
                    else
                    {
                        this.hitBottomSound.Play();
                        markBlocks(triad);
                        RemoveObject(triad);
                        triad        = null;
                        currentState = BlockGridState.MarkBlocksToDestroy;
                    }

                    lastTriadMove = Timer.TicksElapsed;
                }
            }
            catch (SdlException)
            {
            }
        }