private bool PlayerDidWin(PlayerColor player) { // Get the piece count for the other player var pieceCount = (player == PlayerColor.Black) ? _redPieceCount : _blackPieceCount; // TODO: Find out if the other player has any moves left // If the other player is out of pieces, this player won return(pieceCount == 0); }
void NextTurn() { if (playerTurn == Piece.PlayerColor.WHITE) { playerTurn = Piece.PlayerColor.BLACK; return; } playerTurn = Piece.PlayerColor.WHITE; }
public void CapturePiece(PlayerColor player) { if (player == PlayerColor.Black) { _blackPieceCount -= 1; } else { _redPieceCount -= 1; } }
// Instantiate a piece of the given type and color at the given location public Piece InstantiatePiece(Piece.PlayerColor _playerColor, Piece.ChessPieceType _chessPieceType, int _x, int _y) { GameObject _newGameObject = Instantiate(piecePrefab, Vector3.zero, Quaternion.identity); Piece _newPiece = _newGameObject.GetComponent <Piece>(); _newPiece.playerColor = _playerColor; _newPiece.chessPieceType = _chessPieceType; _newPiece.boardPosition = new Vector2Int(_x, _y); _newPiece.Initialize(); return(_newPiece); }
public void SetSprite(Piece.PlayerColor color, Piece.Type type) { if (color == Piece.PlayerColor.WHITE) { SetSprite(_whiteSprites, type.ToString()); } else { SetSprite(_blackSprites, type.ToString()); } }
public void PlayerWon(Piece.PlayerColor player) { _turnIndicatorMessage.text = $"{player.ToString()} Won!"; }