Exemplo n.º 1
0
        void MoveItemToNextPosition(LevelSelectItem item)
        {
            var tr = item.GetComponent <RectTransform>();

            tr.DOAnchorPos(ItemPosition[item.PositionInItems], animationTime, false)
            .OnComplete(moveComplete).SetEase(Ease.Linear);
        }
Exemplo n.º 2
0
        void MoveItemToTargetPosition(LevelSelectItem item, int offset)
        {
            var   seq       = DOTween.Sequence();
            float timeDetla = animationTime / (float)Mathf.Abs(offset);

            for (int i = 0; i < Mathf.Abs(offset); ++i)
            {
                if (offset > 0)
                {
                    item.PositionInItems--;
                }
                else
                {
                    item.PositionInItems++;
                }
                var tr = item.GetComponent <RectTransform>();
                seq.Append(tr.DOAnchorPos(ItemPosition[item.PositionInItems], timeDetla, true));
            }
            seq.OnComplete(moveComplete);
        }