コード例 #1
0
ファイル: DownStates.cs プロジェクト: alex1392/CycTetris.WPF
            public IState Handle(StateCommand command, GameManager gm)
            {
                if (command.Key != PressedKey)
                {
                    return(null);
                }

                if (!command.IsPressed)
                {
                    return(new NormalState());
                }

                if (++DelayCount <= Delay)
                {
                    return(null);
                }

                if (!gm.IsTouchDown())
                {
                    return(new NormalState());
                }

                gm.TouchDown();
                DelayCount = 0;
                return(new NormalState());
            }
コード例 #2
0
ファイル: HoldStates.cs プロジェクト: alex1392/CycTetris.WPF
            public IState Handle(StateCommand command, GameManager gm)
            {
                if (!command.IsPressed)
                {
                    return(null);
                }

                gm.Hold();
                return(new HeldState());
            }
コード例 #3
0
            public IState Handle(StateCommand command, GameManager gm)
            {
                if (!command.IsPressed)
                {
                    return(null);
                }

                var(canExecute, blockExecuted) = gm.MoveCheck(command);
                if (!canExecute)
                {
                    return(null);
                }
                gm.BlockNow = blockExecuted;
                return(new DasState(command.Key));
            }
コード例 #4
0
 public IState Handle(StateCommand command, GameManager gm)
 {
     if (command.Key != PressedKey)
     {
         return(null);
     }
     if (!command.IsPressed)
     {
         return(new NormalState());
     }
     if (++DelayCount <= Delay)
     {
         return(null);
     }
     return(new AutoShiftState(command.Key));
 }
コード例 #5
0
ファイル: DownStates.cs プロジェクト: alex1392/CycTetris.WPF
            public IState Handle(StateCommand command, GameManager gm)
            {
                if (!command.IsPressed)
                {
                    return(null);
                }

                var(canExecute, blockExecuted) = gm.MoveCheck(command);
                if (!canExecute)
                {
                    return(Constants.IsDLD ? new LockDelayState(command.Key) : null);
                }

                gm.BlockNow = blockExecuted;
                return(new AutoShiftState(command.Key));
            }
コード例 #6
0
            public IState Handle(StateCommand command, GameManager gm)
            {
                if (command.Key != PressedKey)
                {
                    return(null);
                }
                if (!command.IsPressed)
                {
                    return(new NormalState());
                }

                if (++DelayCount > Delay)
                {
                    var(canExecute, blockExecuted) = gm.MoveCheck(command);
                    if (!canExecute)
                    {
                        return(new NormalState());
                    }
                    gm.BlockNow = blockExecuted;
                    DelayCount  = 0;
                }
                return(null);
            }