Пример #1
0
        public IGameState Update(InputStatifier inputStatifier)
        {
            frameTimer++;

            if (frameTimer >= framesPerStep)
            {
                if ((curPos <= -width + 1 && curDir == -1) || (curPos + 1 >= gameData.GridWidth && curDir == 1))
                {
                    curDir *= -1;
                }
                curPos += curDir;

                frameTimer = 0;
            }

            for (int x = 0; x < gameData.GridWidth; x++)
            {
                gameData.Gridje[x, gameData.CurrentRow] = x >= curPos && x < (curPos + width);
            }

            if (inputStatifier.UserDoesAction())
            {
                return(new GravityState(gameData));
            }

            return(this);
        }
Пример #2
0
 public IGameState Update(InputStatifier inputStatifier)
 {
     framesDelay--;
     if (framesDelay <= 0 || inputStatifier.UserDoesAction())
     {
         return(new PlayingState(new GameData()));
     }
     return(this);
 }