Пример #1
0
        private static IEnumerator ChangePosition(QuickPolygon shape, Vector3 endValue, InterpolateType interpolateType, float duration)
        {
            Vector3 startValue  = shape.GetPosition();
            float   timeElapsed = 0;

            while (timeElapsed < duration)
            {
                Vector3 newPosition = GetInterpolate(interpolateType, startValue, endValue, timeElapsed, duration);
                shape.SetPosition(newPosition);
                yield return(new WaitForEndOfFrame());

                timeElapsed += Time.deltaTime;
            }
            shape.SetPosition(endValue);
        }