如何在每个 Dotween 循环中翻转游戏对象?

How do I flip the gameobject at every Dotween loop?

transform
    .DOPath(path, animDuration, pathType, pathMode, 10).SetLoops(-1, LoopType.Yoyo)
    .SetEase(ease);

这是我遵循路径的简单双点代码。在每个溜溜球之后,我希望我的对象翻转或改变方向朝向它的下一个路径路标。有什么方法可以做到这一点吗?

DoTween 有 OnStepComplete().

DOTween:

Sets a callback that will be fired each time the tween completes a single loop cycle (meaning that, if you set your loops to 3, OnStepComplete will be called 3 times, contrary to OnComplete which will be called only once at the very end). More...

void Start()
{
    transform
        .DOPath(path, animDuration, pathType, pathMode, 10)
        .SetLoops(-1, LoopType.Yoyo)
        .SetEase(ease).OnStepComplete(FlipScpite);
}

private void FlipScpite()
{
    _spriteRenderer.flipX = !_spriteRenderer.flipX;
}