private void PerformMove(Move move) { LogMoveMove(CurrentMovingPlayer, move.FromFieldIndex, move.ToFieldIndex); CurrentBoard.GetField(move.FromFieldIndex).MoveTo(CurrentBoard.GetField(move.ToFieldIndex)); MovesMade++; TogglePawnDeletingOrSwitchPlayer(); }
private void HandlePawnPlacing(int fieldIndex) { Field selectedField = CurrentBoard.GetField(fieldIndex); if (selectedField.Empty) { CurrentPlayerPlacePawn(fieldIndex); TogglePawnDeletingOrSwitchPlayer(); } }
public void HandlePawnRemoval(int fieldIndex) { Field field = CurrentBoard.GetField(fieldIndex); if (!field.Empty) { if (!field.BelongsTo(CurrentMovingPlayer)) { RemovePawn(field); } } }
private void HandlePawnMoving(int fieldIndex) { Field newField = CurrentBoard.GetField(fieldIndex); PlayerNumber selectedFieldPawnPlayer = newField.PawnPlayerNumber; if (selectedFieldPawnPlayer == CurrentMovingPlayer) { LastSelectedField = newField; } else if (LastSelectedField != null && newField.Empty) { if (CurrentPlayersPawnsLeft <= FLYING_PAWNS_NUMBER) { HandleFlyingMove(newField); } else { HandleNormalMove(newField); } } }
private void RemovePawn(int index) { CurrentBoard.GetField(index).Reset(); }