本文整理汇总了C#中Piece.IsSameColor方法的典型用法代码示例。如果您正苦于以下问题:C# Piece.IsSameColor方法的具体用法?C# Piece.IsSameColor怎么用?C# Piece.IsSameColor使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Piece
的用法示例。
在下文中一共展示了Piece.IsSameColor方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IsValidMove
private bool IsValidMove(Piece currentPiece)
{
MovesBoardController.Instance.HideAllMessages();
if(currentPiece.tile.posX == initialPieceTile.posX && currentPiece.tile.posY == initialPieceTile.posY)
return false;
if(movesOverEmptyTiles != 0){
return false;
}
if(selectedPiece.tile.IsCrossPositionPoint(currentPiece.tile))
{
if(currentPiece.IsSameColor(selectedPiece) || currentPiece.IsSameSymbol(selectedPiece) || currentPiece.IsSameSize(selectedPiece))
{
if(currentPiece.IsSameColor(selectedPiece))
MovesBoardController.Instance.ShowSameColorOK();
if(currentPiece.IsSameSymbol(selectedPiece))
MovesBoardController.Instance.ShowSameSymbolOK();
if(currentPiece.IsSameSize(selectedPiece))
MovesBoardController.Instance.ShowSameSizeOK();
return true;
}
else{
MovesBoardController.Instance.ShowSameSizeError();
MovesBoardController.Instance.ShowSameColorError();
MovesBoardController.Instance.ShowSameSymbolError();
//Debug.Log("Invalid cross move: Pieces are NEITHER same color NOR same symbol NOR same size");
return false;
}
}
else if(selectedPiece.tile.IsCornerPositionPoint(currentPiece.tile))
{
if(currentPiece.IsSameColor(selectedPiece) && currentPiece.IsSameSymbol(selectedPiece))
{
MovesBoardController.Instance.ShowSameColorOK();
MovesBoardController.Instance.ShowSameSymbolOK();
Debug.Log("valid corner move: Pieces are same color and symbol");
return true;
}
else if(currentPiece.IsSameColor(selectedPiece) && currentPiece.IsSameSize(selectedPiece))
{
MovesBoardController.Instance.ShowSameColorOK();
MovesBoardController.Instance.ShowSameSizeOK();
Debug.Log("valid corner move: Pieces are same color and size");
return true;
}
else if(currentPiece.IsSameSymbol(selectedPiece) && currentPiece.IsSameSize(selectedPiece))
{
MovesBoardController.Instance.ShowSameSymbolOK();
MovesBoardController.Instance.ShowSameSizeOK();
Debug.Log("valid corner move: Pieces are same symbol and size");
return true;
}
else{
if(currentPiece.IsSameColor(selectedPiece))
MovesBoardController.Instance.ShowSameColorOK();
else
MovesBoardController.Instance.ShowSameColorError();
if(currentPiece.IsSameSize(selectedPiece))
MovesBoardController.Instance.ShowSameSizeOK();
else
MovesBoardController.Instance.ShowSameSizeError();
if(currentPiece.IsSameSymbol(selectedPiece))
MovesBoardController.Instance.ShowSameSymbolOK();
else
MovesBoardController.Instance.ShowSameSymbolError();
return false;
}
}
else{
MovesBoardController.Instance.ShowInvalidMovementError();
Debug.Log("Invalid move: Neither corner NOR cross move");
return false;
}
}