50 lines
1.8 KiB
C#
50 lines
1.8 KiB
C#
using System;
|
|
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, Guid id,
|
|
List<string> tags, Track targetTrack, FlexibleFloat totalTime)
|
|
{
|
|
TrackTotalTimeChange trackTotalTimeChange = Instantiate(EditorManager.instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
|
|
trackTotalTimeChange.Initialize(elementName, id, tags);
|
|
|
|
trackTotalTimeChange.targetObject = 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.timeDurationSubmodule.SetDuration(totalTime);
|
|
|
|
trackTotalTimeChange.SetParent(targetTrack);
|
|
return trackTotalTimeChange;
|
|
}
|
|
|
|
protected override void UpdateAnimation(float songTime)
|
|
{
|
|
totalTime.UpdateFlexibleFloat(songTime);
|
|
|
|
if (totalTime.returnType == FlexibleReturnType.MiddleExecuting)
|
|
{
|
|
targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value;
|
|
}
|
|
}
|
|
}
|
|
}
|