Ejemplo n.º 1
0
        internal float?InterpolateLinear(float time)
        {
            if (_basePointData == null)
            {
                return(null);
            }

            if (_previousPointData == null)
            {
                return(_basePointData.InterpolateLinear(time));
            }

            return(Mathf.LerpUnclamped(_previousPointData.InterpolateLinear(time), _basePointData.InterpolateLinear(time), Time));
        }
Ejemplo n.º 2
0
        internal static IEnumerator AnimateTrackCoroutine(PointDefinition points, Property property, float duration, float startTime, Functions easing)
        {
            while (true)
            {
                float elapsedTime = Instance.CustomEventCallbackController._audioTimeSource.songTime - startTime;
                float time        = Easings.Interpolate(Mathf.Min(elapsedTime / duration, 1f), easing);
                switch (property.PropertyType)
                {
                case PropertyType.Linear:
                    property.Value = points.InterpolateLinear(time);
                    break;

                case PropertyType.Vector3:
                    property.Value = points.Interpolate(time);
                    break;

                case PropertyType.Vector4:
                    property.Value = points.InterpolateVector4(time);
                    break;

                case PropertyType.Quaternion:
                    property.Value = points.InterpolateQuaternion(time);
                    break;
                }

                if (elapsedTime < duration)
                {
                    yield return(null);
                }
                else
                {
                    break;
                }
            }
        }