private void TiltForfeit(PieceInformation.Colour colour) { List <GameObject> pieces = boardInfo.GetPieceAvailable(); foreach (GameObject piece in pieces) { PieceInformation pieceInfo = piece.GetComponent <PieceInformation>(); if (pieceInfo.colour == colour) { StartCoroutine(pieceAction.FallDown(piece)); } } lossColour = colour; boardInfo.GameEnded = true; }
/// <summary> /// Gets all the active pieces of the same colour and starts knock-down animation /// </summary> void KingForfeit() { boardInfo.GameEnded = true; List <GameObject> pieces = boardInfo.GetPieceAvailable(); // If piece is forfeited player's piece, make piece collapse foreach (GameObject piece in pieces) { PieceInformation thisPiece = piece.GetComponent <PieceInformation>(); if (thisPiece.type != type && thisPiece.colour == colour) { StartCoroutine(pieceAction.FallDown(piece)); } } // Display result boardInfo.Forfeit(); }