/// <summary> /// Action up and down of snake /// </summary> private void SetActionForSnake() { _actionOfSnake = DOTween.Sequence(); _actionOfSnake.Append(Trans.DOMoveY(0f, 1f).SetRelative().SetEase(Ease.Linear). OnUpdate(CheckForGoOut)); _actionOfSnake.Append(Trans.DOMoveY(2f, 1f).SetSpeedBased(true). SetRelative().SetEase(Ease.Linear).SetUpdate(UpdateType.Fixed)); _actionOfSnake.Append(Trans.DOMoveY(-2f, 2f).SetSpeedBased(true) .SetRelative().SetEase(Ease.Linear).SetUpdate(UpdateType.Fixed).SetDelay(1f)); _actionOfSnake.SetLoops(-1, LoopType.Restart); }