Пример #1
0
 private bool TryMove(BlockController sender, BlockPoint newPoint)
 {
     if (_blocks[newPoint.X, newPoint.Y] == null)
     {
         _blocks[sender.Position.X, sender.Position.Y] = null;
         _blocks[newPoint.X, newPoint.Y] = sender;
         sender.AcceptMove();
     }
 }
 private void OnClickMove(BlockController sender, Side side, BlockPoint newPoint)
 {
     if (_blocks[newPoint.X, newPoint.Y] == null && AllowClickMoved(sender))
     {
         sender.Moved     = true;
         sender.IsStarted = false;
         sender.AcceptMove();
         CallMoveClick();
     }
 }
 private void OnBlockTryMove(BlockController sender, Side side, BlockPoint newPoint)
 {
     if (_blocks[newPoint.X, newPoint.Y] == null)
     {
         _blocks[sender.Position.X, sender.Position.Y] = null;
         _blocks[newPoint.X, newPoint.Y] = sender;
         sender.AcceptMove();
         _moveCount++;
     }
 }
Пример #4
0
 private bool OnClickMove(BlockController sender, BlockPoint newPoint)
 {
     if (_blocks[newPoint.X, newPoint.Y] == null && AllowClickMoved(sender))
     {
         sender.Moved     = true;
         sender.IsStarted = false;
         sender.AcceptMove();
         return(true);
     }
     return(false);
 }
Пример #5
0
        private bool ReverceMove(BlockController sender, BlockPoint newPoint)
        {
            int x = newPoint.X;
            int y = newPoint.Y;

            if (x < 0 || x >= _weightGamePole || y < 0 || y >= _heightGamePole)
            {
                _blocksGenerator.SetBlock(sender);
                MoveBall();
                return(false);
            }

            var nextBlock = _blocks[x, y];

            if (nextBlock != null && nextBlock.IsStarted)
            {
                nextBlock.Reverce();
                _changedBlock.Add(sender, newPoint);
                sender.AcceptMove();
                return(true);
            }
            return(false);
        }