public void SwapWithNeighbor(int dx, int dy) { int neighborX = BoardPiece.X + dx; int neighborY = BoardPiece.Y + dy; if (_board.IsOutOfBounds(neighborX, neighborY)) { BoardPiece.EnterReadyForMatchState(); return; } var neighbor = _board.GetPieceAt(neighborX, neighborY); if (neighbor == null || neighbor.CurrentState != BoardPiece.EState.ReadyForMatch) { BoardPiece.EnterReadyForMatchState(); return; } _board.SelectPiece(neighbor); if (_board.IsReadyToSwap()) { _board.SwapCandidates(); } }
public void OnPointerClick(PointerEventData eventData) { BoardPiece.EnterReadyForMatchState(); if (_board.IsReadyToSwap()) { _board.SwapCandidates(); } _isBeingDragged = false; }
private void OnFellCompleted() { BoardPiece.EnterReadyForMatchState(); if (FellCompleted != null) { FellCompleted(this, EventArgs.Empty); } TryToMatch(); }
private void OnSwapCompleted() { BoardPiece.EnterReadyForMatchState(); if (_board.IsReadyToSwap()) { if (!TryToMatchSwap()) { _board.SwapCandidates(); } _board.ConfirmSwappedPieces(); } }