Files
ichni_Creator_Studio/Assets/Scripts/Animations/Track/TrackTotalTimeChange.cs
SoulliesOfficial 5f64c4faf8 基础内容-6
技术性调整;
Note效果;
2025-01-30 22:45:33 -05:00

44 lines
1.6 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Lean.Pool;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class TrackTotalTimeChange : AnimationBase
{
public FlexibleFloat totalTime;
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
public static TrackTotalTimeChange GenerateElement(string elementName, Track targetTrack, FlexibleFloat totalTime)
{
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
trackTotalTimeChange.NewInitialize(elementName, targetTrack);
if (targetTrack.trackTimeSubmodule is TrackTimeSubmoduleStatic submoduleStatic)
{
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = submoduleStatic;
}
else
{
throw new System.Exception("Target object does not have a TrackTimeSubmoduleStatic");
}
trackTotalTimeChange.totalTime = totalTime;
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
trackTotalTimeChange.SetTimeDuration(totalTime);
return trackTotalTimeChange;
}
protected override void UpdateAnimation(float songTime)
{
totalTime.UpdateFlexibleFloat(songTime);
if (totalTime.returnType == FlexibleReturnType.MiddleExecuting)
{
targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value;
}
}
}
}