private async Task CheckJumpEatTo(Path.Path path, bool ignoreValidateMovement) { if (path.GetNextStep() == Movement.Direction.Final) { if (CurrentChessPiece == null && (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this))) { CanMoveHere.Add(path); } else if (CurrentChessPiece?.IsWhite() != path.StartCell.CurrentChessPiece?.IsWhite() && (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this))) { CanEatHere.Add(path); } return; } if (Movements[path.GetStep()] != null) { await Movements[path.GetStep()].CheckJumpEatTo(path, ignoreValidateMovement); } }
private async Task MarkEatTo(Path.Path path, bool ignoreValidateMovement) { if (CurrentChessPiece != null) { if (CurrentChessPiece.IsWhite() != path.StartCell.CurrentChessPiece?.IsWhite() && (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this))) { CanEatHere.Add(path); } return; } if (Movements[path.GetNextStep()] != null) { await Movements[path.GetStep()].MarkEatTo(path, ignoreValidateMovement); } }
private async Task MarkMoveTo(Path.Path path, bool ignoreValidateMovement) { if (CurrentChessPiece != null) { return; } if (ignoreValidateMovement || await Board.ValidateMovement(path.StartCell, this)) { CanMoveHere.Add(path); } if (Movements[path.GetNextStep()] != null) { await Movements[path.GetStep()].MarkMoveTo(path, ignoreValidateMovement); } }