Files
ichni_Official/Assets/Scripts/Game/Animations/Track/TrackTotalTimeChange.cs

59 lines
2.1 KiB
C#
Raw Normal View History

2025-06-03 02:42:28 -04:00
using System;
using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
namespace Ichni.RhythmGame
{
public partial class TrackTotalTimeChange : AnimationBase
{
2026-03-14 03:13:10 -04:00
#region [] Exposed Fields & References
2025-06-03 02:42:28 -04:00
public FlexibleFloat totalTime;
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Lifecycle & Factory
2025-06-03 02:42:28 -04:00
public static TrackTotalTimeChange GenerateElement(string elementName, Guid id,
List<string> tags, bool isFirstGenerated, Track animatedTrack, FlexibleFloat totalTime)
{
2026-03-14 03:13:10 -04:00
TrackTotalTimeChange trackTotalTimeChange = Instantiate(GameManager.Instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
2025-06-03 02:42:28 -04:00
trackTotalTimeChange.Initialize(elementName, id, tags, isFirstGenerated, animatedTrack);
trackTotalTimeChange.animatedObject = animatedTrack;
trackTotalTimeChange.targetTrackTimeSubmoduleStatic = animatedTrack.trackTimeSubmodule as TrackTimeSubmoduleStatic;
trackTotalTimeChange.totalTime = totalTime;
trackTotalTimeChange.animationReturnType = FlexibleReturnType.Before;
//trackTotalTimeChange.timeDurationSubmodule.SetDuration(totalTime);
return trackTotalTimeChange;
}
public override void SetDefaultSubmodules()
{
timeDurationSubmodule = new TimeDurationSubmodule(this);
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
2026-03-14 03:13:10 -04:00
#region [] Core Animation Logic
2026-04-03 10:53:11 -04:00
protected override void UpdateAnimation(float songTime, bool forceUpdate)
2025-06-03 02:42:28 -04:00
{
totalTime.UpdateFlexibleFloat(songTime);
if (totalTime.returnType == FlexibleReturnType.MiddleExecuting)
{
targetTrackTimeSubmoduleStatic.trackTotalTime = totalTime.value;
}
}
public override void ApplyTimeOffset(float offset)
{
base.ApplyTimeOffset(offset);
totalTime.animations.ForEach(anim => anim.ApplyTimeOffset(offset));
}
2026-03-14 03:13:10 -04:00
#endregion
2025-06-03 02:42:28 -04:00
}
}