设置扩展
This commit is contained in:
@@ -32,6 +32,47 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Rebuilds the list of elements whose active state is driven by a finite time duration.
|
||||
/// This preserves the existing runtime filter, while avoiding a LINQ allocation during
|
||||
/// every project load.
|
||||
/// </summary>
|
||||
public void RebuildRuntimeTimeDurations()
|
||||
{
|
||||
List<TimeDurationSubmodule> runtimeTimeDurations = GameManager.Instance.timeDurations;
|
||||
runtimeTimeDurations.Clear();
|
||||
|
||||
float songLength = GameManager.Instance.songInformation.songLength;
|
||||
for (int i = 0; i < gameElementList.Count; i++)
|
||||
{
|
||||
if (gameElementList[i] is not IHaveTimeDurationSubmodule timeDurationHost)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
TimeDurationSubmodule timeDuration = timeDurationHost.timeDurationSubmodule;
|
||||
if (timeDuration != null &&
|
||||
(timeDuration.startTime > 0f || timeDuration.endTime < songLength))
|
||||
{
|
||||
runtimeTimeDurations.Add(timeDuration);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Immediately applies the active state for the registered time-duration elements.
|
||||
/// Used at loading-state boundaries so the first rendered frame already matches the
|
||||
/// current song timeline.
|
||||
/// </summary>
|
||||
public void SyncRuntimeTimeDurationStates(float songTime)
|
||||
{
|
||||
List<TimeDurationSubmodule> runtimeTimeDurations = GameManager.Instance.timeDurations;
|
||||
for (int i = 0; i < runtimeTimeDurations.Count; i++)
|
||||
{
|
||||
runtimeTimeDurations[i]?.DetectAndSwitchActiveState(songTime);
|
||||
}
|
||||
}
|
||||
|
||||
public void SetUpInspector()
|
||||
{
|
||||
throw new System.NotImplementedException();
|
||||
@@ -43,4 +84,4 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user