public GameBoardUpdate Move(Coordinate from, Coordinate to, MoveType moveType) { GameBoardUpdate update = new GameBoardUpdate(); // change, no initializetion needed // Ability Uno if (moveType == MoveType.AbilityUno) { table[from.Row, from.Column].Piece.AbilityUno(table, ref turn); // update = UpdateHistory(); UpdatePits(); } // Ability With Interacter /* * else if (moveType == MoveType.AbilityWithInteracter) * { * interacterSquare = selectedSquare.Piece.AbilityWithInteracterStageOne(table, sen); * * // If the piece is hiddenly frozen, ability with interacter stage one returns null. Then cur should also be null. * if (interacterSquare == null) * selectedSquare = null; * * // Don't check for gameEnded * return; * }*/ // Move else if (moveType == MoveType.Shift || moveType == MoveType.Capture || moveType == MoveType.Jump) { update = table[from.Row, from.Column].Piece.Move(table, to.Row, to.Column, ref turn); UpdateHistory(); UpdatePits(); } else { throw new Exception("I dont think this can happen but you mey never know."); // change } return(update); }
public bool Move(Coordinate from, Coordinate to) { // If from coordinate is null if (from == null) { throw new Exception("From coordinate given cannot be null"); } // Get rid of all the indicators for (int i = 0; i < possibleMoveIndicators.Length; i++) { Destroy(possibleMoveIndicators[i]); } possibleMoveIndicators = null; // Check if the destination is one of the possible moves for (int i = 0; i < possibleMoves.Count; i++) { if (possibleMoves[i].Row == to.Row && possibleMoves[i].Column == to.Column) { Debug.Log("Move is aloud. Sending move signal to logic coordinator."); GameBoardUpdate update = gameLogicCoordinator.Move(from, to, possibleMoves[i].MoveType); possibleMoves = null; PhotonNetwork.RaiseEvent(PlayerNetworking.movePieceGameEventCode, new MoveInfoGame(possibleMoves[i].MoveType, from, to), new RaiseEventOptions { Receivers = ReceiverGroup.Others }, new SendOptions { Reliability = true }); // proccess update return(true); } } possibleMoves = null; return(false); }