59 lines
2.1 KiB
C#
59 lines
2.1 KiB
C#
using System;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Ichni.RhythmGame.Beatmap;
|
|
|
|
namespace Ichni.RhythmGame
|
|
{
|
|
public partial class TrackTotalTimeChange : AnimationBase
|
|
{
|
|
#region [暴露属性字段与关联] Exposed Fields & References
|
|
public FlexibleFloat totalTime;
|
|
public TrackTimeSubmoduleStatic targetTrackTimeSubmoduleStatic;
|
|
#endregion
|
|
|
|
#region [生命周期与工厂] Lifecycle & Factory
|
|
public static TrackTotalTimeChange GenerateElement(string elementName, Guid id,
|
|
List<string> tags, bool isFirstGenerated, Track animatedTrack, FlexibleFloat totalTime)
|
|
{
|
|
TrackTotalTimeChange trackTotalTimeChange = Instantiate(GameManager.Instance.basePrefabs.emptyObject).AddComponent<TrackTotalTimeChange>();
|
|
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);
|
|
}
|
|
#endregion
|
|
|
|
#region [核心动画逻辑] Core Animation Logic
|
|
protected override void UpdateAnimation(float songTime, bool forceUpdate)
|
|
{
|
|
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));
|
|
}
|
|
#endregion
|
|
}
|
|
|
|
}
|