void MovePiece(Vector2 moveCoordinate) //moving the piece { ShowMoves(); //this hides the move buttons Vector2 movePos = new Vector2((moveCoordinate.x * gridSize) + gridOrigin.x, (moveCoordinate.y * gridSize) + gridOrigin.y); //selects move pos rectTransform.localPosition = movePos; //moves piece chessController.TakePiece(moveCoordinate); //asks controller to remove any piece landed on gridCoordinate = moveCoordinate; //updates grid coordinate thisInformation.gridCoordinate = moveCoordinate; //updates piece information grid coordinate chessController.EnablePieces(); audioSource.Play(); }
void MovePiece(Vector2 moveCoordinate) //moving the piece { ShowMoves(); //this hides the move buttons if (firstMove) { firstMove = false; //if moved on first move, first move is false } Vector2 movePos = new Vector2((moveCoordinate.x * gridSize) + gridOrigin.x, (moveCoordinate.y * gridSize) + gridOrigin.y); //selects move pos rectTransform.localPosition = movePos; //moves piece chessController.TakePiece(moveCoordinate); //asks controller to remove any piece landed on gridCoordinate = moveCoordinate; //updates grid coordinate thisInformation.gridCoordinate = moveCoordinate; //updates piece information grid coordinate chessController.EnablePieces(); audioSource.Play(); if (CheckIfOtherSide(moveCoordinate.y)) { UpgradePawnToQueen(moveCoordinate); } }
void MovePiece(Vector2 moveCoordinate) //moving the piece { ShowMoves(); //this hides the move buttons Vector2 movePos = new Vector2((moveCoordinate.x * gridSize) + gridOrigin.x, (moveCoordinate.y * gridSize) + gridOrigin.y); //selects move pos rectTransform.localPosition = movePos; //moves piece chessController.TakePiece(moveCoordinate, piece); //asks controller to remove any piece landed on gridCoordinate = moveCoordinate; //updates grid coordinate if (CheckMovedTwoSquares()) { chessController.AddEnPassant(this); } firstMove = false; if (CheckPawnUpgrade()) { UpgradeToQueen(); } chessController.EnablePieces(); audioSource.Play(); }