This commit is contained in:
SoulliesOfficial
2026-06-05 04:45:57 -04:00
parent 3a63641a2c
commit 7c60c40d6b
377 changed files with 10970 additions and 843 deletions

View File

@@ -10,7 +10,7 @@ using UnityEngine.Serialization;
namespace Ichni.RhythmGame
{
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule
public partial class Track : GameElement, IHaveTransformSubmodule, IHaveTimeDurationSubmodule, IScheduledElement
{
#region [] Essential Configs
public GameObject trackRenderer;
@@ -50,7 +50,11 @@ namespace Ichni.RhythmGame
{
base.AfterInitialize();
GameManager.Instance.trackManager.RegisterTrack(this);
// 保留 TrackManager 注册以维持 ManualLateUpdate 的 refreshedThisFrame 清除逻辑
GameManager.Instance.trackManager.RegisterTrack(this);
// 注册调度器 Phase 4TrackCore驱动 ManualUpdate
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackCore, this);
CoreServices.UpdateScheduler.RegisterTrackSpline(this);
if (trackPathSubmodule != null && trackPathSubmodule.pathNodeList.Count > 3)
{
@@ -77,6 +81,15 @@ namespace Ichni.RhythmGame
{
if(trackPathSubmodule != null) trackPathSubmodule.refreshedThisFrame = false;
}
#region [IScheduledElement] Scheduler Interface
public void ScheduledUpdate(UpdatePhase phase, float songTime)
{
ManualUpdate(songTime);
}
public bool IsScheduledActive => isActiveAndEnabled;
#endregion
#endregion
#region [] Behavior Overrides
@@ -91,6 +104,8 @@ namespace Ichni.RhythmGame
public override void OnDelete()
{
GameManager.Instance.trackManager.UnregisterTrack(this);
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackCore, this);
CoreServices.UpdateScheduler.UnregisterTrackSpline(this);
if (parentElement is ElementFolder folder) folder.trackList.Remove(this);
}
#endregion