void Update() { if (Ruler == 0) { return; } if (MyKing.GetComponent <UnitBehavior>().enemiesBehind()) { RunAway(); } else { Normal(); } }
void Update() { if (Ruler == 0) { return; } if (MyKing.GetComponent <UnitBehavior>().enemiesInfront()) { Charge(); } else { StopCharge(); } }
public PieceType GetPieceType(SquareFlag square) { var colour = GetPieceColour(square); if (colour == Colour.None) { return(PieceType.None); } if (Colour == colour) { if (MyPawns.HasFlag(square)) { return(PieceType.Pawn); } if (MyRooks.HasFlag(square)) { return(PieceType.Rook); } if (MyKnights.HasFlag(square)) { return(PieceType.Knight); } if (MyBishops.HasFlag(square)) { return(PieceType.Bishop); } if (MyQueens.HasFlag(square)) { return(PieceType.Queen); } if (MyKing.HasFlag(square)) { return(PieceType.King); } } else { if (OpponentPawns.HasFlag(square)) { return(PieceType.Pawn); } if (OpponentRooks.HasFlag(square)) { return(PieceType.Rook); } if (OpponentKnights.HasFlag(square)) { return(PieceType.Knight); } if (OpponentBishops.HasFlag(square)) { return(PieceType.Bishop); } if (OpponentQueens.HasFlag(square)) { return(PieceType.Queen); } if (OpponentKing.HasFlag(square)) { return(PieceType.King); } } throw new Exception($"Failed to find piece for {square}"); }