示例#1
0
    public void SlideSelection(int directionX, int directionY)
    {
        if (CurrentState != GameState.Selecting)
        {
            return;
        }

        if (!selectedX.HasValue || !selectedY.HasValue || Board[selectedY.Value, selectedX.Value] == null || SelectedBlock == null ||
            selectedX.Value + directionX < 0 || selectedY.Value + directionY < 0 || selectedX.Value + directionX >= Cols ||
            selectedY.Value + directionY >= Rows || Board[selectedY.Value + directionY, selectedX.Value + directionX] != null)
        {
            return;
        }

        SoundBoard.PlayBlockShift();
        Board[selectedY.Value, selectedX.Value].StartSliding(directionX, directionY);
    }