protected IObservable <Unit> Move(Dir dir, float duration) { RotateTo(dir); var res = Observable.ReturnUnit(); if (dir == Dir.up || dir == Dir.down) { return(res); } return(res .Do(_ => { var tgt = null as Transform; switch (dir) { case Dir.left: tgt = Level.Instance.PreviousAnchor(transform.position); break; case Dir.right: tgt = Level.Instance.NextAnchor(transform.position); break; } Rb.DOKill(); movingSequence?.Kill(); movingSequence = DOTween.Sequence() .AppendCallback(() => Anim.SetBool("Moving", true)) .Append(Rb.DOMoveX(tgt.position.x, duration).SetEase(Ease.OutSine)) .AppendInterval(duration * .5f) .AppendCallback(() => Anim.SetBool("Moving", false)); }) .Delay(TimeSpan.FromSeconds(duration * .5f))); }