public bool IsValidSwap(GemSwapData data) { if ((data.indexA == index1 && data.indexB == index2) || (data.indexA == index2 && data.indexB == index1)) { return true; } return false; }
void GemSwapper_Swapped(object sender, GemSwapEventArgs e) { Debug.Log("PuzzleGameController Swapped Event"); GemSwapData swap = new GemSwapData(e.indexA, e.indexB, e.isValid); e.isValid = PresentationMatchChecker.Instance.CheckForValidSwap(swap); PuzzlePresentationController.SwapTwoGems(e.indexA, e.indexB, e.isValid); }
public bool IsValidSwap(GemSwapData data) { if ((data.indexA == index1 && data.indexB == index2) || (data.indexA == index2 && data.indexB == index1)) { return(true); } return(false); }
public bool CheckForValidSwap(GemSwapData swap) { var retval = false; PuzzlePresentation.Instance.SwapTwoGridCellsStraight(swap.indexA, swap.indexB); var match1x = GetOneIndexMatchData(swap.indexA); var match2x = GetOneIndexMatchData(swap.indexB); if (match1x != null || match2x != null) { retval = true; } PuzzlePresentation.Instance.SwapTwoGridCellsStraight(swap.indexA, swap.indexB); return(retval); }
public bool CheckForValidSwap(GemSwapData data) { if (allowAllSwaps == true) return true; //don't check the possible moves, just check the board PuzzleBoard.SwapTwoGems(data.indexA, data.indexB); CheckBoardForMatches(); PuzzleBoard.SwapTwoGems(data.indexA, data.indexB); /* foreach (PossibleMoveData move in PossibleMoves) { if (move.IsValidSwap(data)) return true; }*/ return BoardMatchData.MatchedCount() > 0; }
public bool CheckForValidSwap(GemSwapData data) { if (allowAllSwaps == true) { return(true); } //don't check the possible moves, just check the board PuzzleBoard.SwapTwoGems(data.indexA, data.indexB); CheckBoardForMatches(); PuzzleBoard.SwapTwoGems(data.indexA, data.indexB); /* foreach (PossibleMoveData move in PossibleMoves) * { * if (move.IsValidSwap(data)) * return true; * }*/ return(BoardMatchData.MatchedCount() > 0); }
public bool CheckForValidSwap(GemSwapData swap) { var retval = false; PuzzlePresentation.Instance.SwapTwoGridCellsStraight(swap.indexA, swap.indexB); var match1x = GetOneIndexMatchData(swap.indexA); var match2x = GetOneIndexMatchData(swap.indexB); if (match1x != null || match2x != null) { retval = true; } PuzzlePresentation.Instance.SwapTwoGridCellsStraight(swap.indexA, swap.indexB); return retval; }