同步
This commit is contained in:
@@ -6,7 +6,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class SkyboxSubsetter : GameElement
|
||||
public partial class SkyboxSubsetter : GameElement, IScheduledElement
|
||||
{
|
||||
#region [核心组件与天空盒列表] Core Components & Skybox Lists
|
||||
public SkyboxBlender skyboxBlender;
|
||||
@@ -46,6 +46,18 @@ namespace Ichni.RhythmGame
|
||||
skyboxSubsetter.selectedSkybox = String.Empty;
|
||||
return skyboxSubsetter;
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.Misc, this);
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Misc, this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [内部设置与工具] Internal Configs & Utils
|
||||
@@ -81,28 +93,31 @@ namespace Ichni.RhythmGame
|
||||
#endregion
|
||||
|
||||
#region [轮询更新] Main Update
|
||||
private void Update()
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
if (skyBoxThemeBundleList.Count > 1)
|
||||
{
|
||||
float songTime = CoreServices.TimeProvider.SongTime;
|
||||
float delay = GameManager.Instance.songInformation.delay;
|
||||
float finalTime = 32767; // 曲目长度
|
||||
const float finalTime = 32767f; // 曲目长度上限
|
||||
|
||||
for (var index = 0; index < blendTimeList.Count + 1; index++)
|
||||
{
|
||||
float startTime = index == 0 ? -delay : blendTimeList[index - 1];
|
||||
float endTime = index >= blendTimeList.Count ? finalTime : blendTimeList[index];
|
||||
if(songTime >= startTime && songTime < endTime && currentSkyboxIndex != index)
|
||||
if (songTime >= startTime && songTime < endTime && currentSkyboxIndex != index)
|
||||
{
|
||||
currentSkyboxIndex = index;
|
||||
if(currentSkyboxIndex != 0) skyboxBlender.blendSpeed = blendSpeedList[currentSkyboxIndex - 1];
|
||||
if (currentSkyboxIndex != 0) skyboxBlender.blendSpeed = blendSpeedList[currentSkyboxIndex - 1];
|
||||
skyboxBlender.Blend(currentSkyboxIndex, false);
|
||||
DynamicGI.UpdateEnvironment();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
#endregion
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user