同步
This commit is contained in:
@@ -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 4(TrackCore)驱动 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
|
||||
|
||||
Reference in New Issue
Block a user