Пример #1
0
        internal Vector3?Interpolate(float time)
        {
            if (_basePointData == null)
            {
                return(null);
            }

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

            return(Vector3.LerpUnclamped(_previousPointData.Interpolate(time), _basePointData.Interpolate(time), Time));
        }
Пример #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;
                }
            }
        }
        internal static void GetDefinitePositionOffset(NoodleObjectData.AnimationObjectData animationObject, Track track, float time, out Vector3?definitePosition)
        {
            PointDefinition localDefinitePosition = animationObject.LocalDefinitePosition;

            Vector3?pathDefinitePosition = localDefinitePosition?.Interpolate(time) ?? TryGetVector3PathProperty(track, DEFINITEPOSITION, time);

            if (pathDefinitePosition.HasValue)
            {
                Vector3?pathPosition   = animationObject.LocalPosition?.Interpolate(time) ?? TryGetVector3PathProperty(track, POSITION, time);
                Vector3?positionOffset = SumVectorNullables((Vector3?)TryGetPropertyAsObject(track, POSITION), pathPosition);
                definitePosition = SumVectorNullables(positionOffset, pathDefinitePosition) * NoteLinesDistance;

                if (NoodleController.LeftHandedMode)
                {
                    MirrorVectorNullable(ref definitePosition);
                }
            }
            else
            {
                definitePosition = null;
            }
        }