同步
This commit is contained in:
@@ -1,18 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class Dodger : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
@@ -25,6 +25,12 @@ namespace Ichni.RhythmGame
|
||||
public float orthographicSize;
|
||||
|
||||
public float perspectiveOffset;
|
||||
public float zoomOffset; // 用于效果(如CameraZoomEffect)的临时视野偏移
|
||||
|
||||
public void RefreshFOV()
|
||||
{
|
||||
cam.fieldOfView = perspectiveAngle + perspectiveOffset + zoomOffset;
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [子模块接口与关联引用] Submodules & References
|
||||
@@ -54,14 +60,14 @@ namespace Ichni.RhythmGame
|
||||
float ratioDifference = UIManager.GetScreenRatio() - UIManager.StandardRatio;
|
||||
if (ratioDifference > 0)
|
||||
{
|
||||
gameCamera.perspectiveOffset = -22f * ratioDifference;
|
||||
//gameCamera.perspectiveOffset = 12.5f * ratioDifference;
|
||||
}
|
||||
else
|
||||
{
|
||||
//gameCamera.perspectiveOffset = 11f * ratioDifference;
|
||||
gameCamera.perspectiveOffset = -25f * ratioDifference;
|
||||
}
|
||||
|
||||
gameCamera.cam.fieldOfView = perspectiveAngle + gameCamera.perspectiveOffset;
|
||||
gameCamera.RefreshFOV();
|
||||
return gameCamera;
|
||||
}
|
||||
|
||||
|
||||
@@ -7,7 +7,7 @@ using Object = UnityEngine.Object;
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
|
||||
public partial class ParticleEmitter : GameElement, IHaveParticles, IHaveTimeDurationSubmodule, IHaveTransformSubmodule, IHaveColorSubmodule
|
||||
public partial class ParticleEmitter : GameElement, IHaveParticles, IHaveTimeDurationSubmodule, IHaveTransformSubmodule, IHaveColorSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public string themeBundleName;
|
||||
@@ -85,15 +85,26 @@ namespace Ichni.RhythmGame
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
#region [轮询更新与交互重写] Main Update & Behavior Overrides
|
||||
public partial class ParticleEmitter
|
||||
{
|
||||
private void Update()
|
||||
private void UpdateParticlePlayState(float songTime)
|
||||
{
|
||||
float songTime = CoreServices.TimeProvider.SongTime;
|
||||
if (playTime > songTime || stopTime < songTime)
|
||||
{
|
||||
particle.Stop();
|
||||
@@ -107,6 +118,15 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
UpdateParticlePlayState(songTime);
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
|
||||
public override void Refresh()
|
||||
{
|
||||
base.Refresh();
|
||||
|
||||
@@ -8,12 +8,18 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule
|
||||
public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public float time; //触发效果的时间
|
||||
#endregion
|
||||
|
||||
#region [运行时缓存] Cached Effect Lists
|
||||
private List<EffectBase> _priorEffects;
|
||||
private List<EffectBase> _defaultEffects;
|
||||
private List<EffectBase> _lateEffects;
|
||||
#endregion
|
||||
|
||||
#region [子模块接口] Submodules
|
||||
public TransformSubmodule transformSubmodule { get; set; }
|
||||
public EffectSubmodule effectSubmodule { get; set; }
|
||||
@@ -34,31 +40,55 @@ namespace Ichni.RhythmGame
|
||||
transformSubmodule = new TransformSubmodule(this);
|
||||
effectSubmodule = new EffectSubmodule(this);
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
CacheEffectLists();
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 缓存 effectCollection 中的 Prior/Default/Late 列表引用,
|
||||
/// 避免 ScheduledUpdate 中每帧执行 Dictionary string key 查找。
|
||||
/// </summary>
|
||||
private void CacheEffectLists()
|
||||
{
|
||||
if (effectSubmodule?.effectCollection == null) return;
|
||||
effectSubmodule.effectCollection.TryGetValue("Prior", out _priorEffects);
|
||||
effectSubmodule.effectCollection.TryGetValue("Default", out _defaultEffects);
|
||||
effectSubmodule.effectCollection.TryGetValue("Late", out _lateEffects);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [轮询更新] Main Update
|
||||
private void Update()
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
if (!GameManager.Instance.songPlayer.isUpdating || effectSubmodule == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (effectSubmodule == null) return;
|
||||
|
||||
foreach (EffectBase effect in effectSubmodule.effectCollection["Prior"])
|
||||
{
|
||||
effect.UpdateEffect(time);
|
||||
}
|
||||
UpdateEffectList(_priorEffects, time);
|
||||
UpdateEffectList(_defaultEffects, time);
|
||||
UpdateEffectList(_lateEffects, time);
|
||||
}
|
||||
|
||||
foreach (EffectBase effect in effectSubmodule.effectCollection["Default"])
|
||||
private static void UpdateEffectList(List<EffectBase> effects, float effectTime)
|
||||
{
|
||||
if (effects == null) return;
|
||||
for (int i = 0; i < effects.Count; i++)
|
||||
{
|
||||
effect.UpdateEffect(time);
|
||||
}
|
||||
|
||||
foreach (EffectBase effect in effectSubmodule.effectCollection["Late"])
|
||||
{
|
||||
effect.UpdateEffect(time);
|
||||
effects[i].UpdateEffect(effectTime);
|
||||
}
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ namespace Ichni.RhythmGame
|
||||
public override bool CheckJudgeAvailability(InputUnit inputUnit)
|
||||
{
|
||||
Vector2 inputScreenPosition = inputUnit.inputPosition;
|
||||
Vector2 noteScreenPosition = note.GetScreenPosition();
|
||||
Vector2 noteScreenPosition = note.noteScreenPosition != Vector2.zero ? note.noteScreenPosition : note.GetScreenPosition();
|
||||
float scaledBaseRadius = areaRadius * CurrentScreenRatio;
|
||||
|
||||
float dx = Mathf.Abs(inputScreenPosition.x - noteScreenPosition.x) / ellipseXMultiplier;
|
||||
|
||||
@@ -295,6 +295,7 @@ namespace Ichni.RhythmGame
|
||||
protected virtual void ExecuteJudge(NoteJudgeType judgeType, float triggerTime)
|
||||
{
|
||||
isDuringJudging = false;
|
||||
isFirstJudged = true;
|
||||
judgedTriggerTime = triggerTime;
|
||||
judgedType = judgeType;
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -9,7 +9,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class CrossTrackPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
public partial class CrossTrackPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public ElementFolder trackListFolder;
|
||||
@@ -45,10 +45,16 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
GameManager.Instance.trackManager.RegisterCrossPoint(this);
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
|
||||
base.AfterInitialize();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
|
||||
public override void SetDefaultSubmodules()
|
||||
{
|
||||
timeDurationSubmodule = new TimeDurationSubmodule(this);
|
||||
@@ -68,11 +74,20 @@ namespace Ichni.RhythmGame
|
||||
trackPercent.returnType == FlexibleReturnType.After)
|
||||
{
|
||||
trackPositioner.SetPercent(1);
|
||||
GameManager.Instance.trackManager.UnregisterCrossPoint(this);
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
ManualUpdate(songTime);
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
|
||||
private void SetPoint()
|
||||
{
|
||||
if (nowAttachedTrackIndex != trackSwitch.value &&
|
||||
@@ -82,6 +97,7 @@ namespace Ichni.RhythmGame
|
||||
nowAttachedTrack = trackListFolder.trackList[trackSwitch.value];
|
||||
nowAttachedTrackIndex = trackSwitch.value;
|
||||
trackPositioner.spline = trackListFolder.trackList[trackSwitch.value].trackPathSubmodule.path;
|
||||
trackPositioner.RebuildImmediate();
|
||||
}
|
||||
|
||||
trackPositioner.SetPercent(trackPercent.value);
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class TrackHeadPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
public partial class TrackHeadPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public Track track;
|
||||
@@ -53,9 +53,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
GameManager.Instance.trackManager.RegisterHeadPoint(this);
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
|
||||
base.AfterInitialize();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [轮询更新] Main Update
|
||||
@@ -68,9 +74,18 @@ namespace Ichni.RhythmGame
|
||||
|
||||
if(track.timeDurationSubmodule.CheckAfterEndTime(currentSongTime))
|
||||
{
|
||||
GameManager.Instance.trackManager.UnregisterHeadPoint(this);
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
}
|
||||
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
ManualUpdate(songTime);
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace Ichni.RhythmGame
|
||||
/// <summary>
|
||||
/// 在轨道上根据百分比进行运动的点
|
||||
/// </summary>
|
||||
public partial class TrackPercentPoint : GameElement, IHaveTimeDurationSubmodule
|
||||
public partial class TrackPercentPoint : GameElement, IHaveTimeDurationSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public Track track;
|
||||
@@ -52,9 +52,15 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
GameManager.Instance.trackManager.RegisterPercentPoint(this);
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.TrackFollower, this);
|
||||
base.AfterInitialize();
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [轮询更新] Main Update
|
||||
@@ -73,10 +79,19 @@ namespace Ichni.RhythmGame
|
||||
if (trackPercent.returnType == FlexibleReturnType.After)
|
||||
{
|
||||
trackPositioner.SetPercent(1);
|
||||
GameManager.Instance.trackManager.UnregisterPercentPoint(this);
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.TrackFollower, this);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
ManualUpdate(songTime);
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
#endregion
|
||||
}
|
||||
|
||||
|
||||
@@ -65,14 +65,17 @@ namespace Ichni.RhythmGame
|
||||
path.type = Spline.Type.Linear;
|
||||
path.sampleRate = 1;
|
||||
}
|
||||
|
||||
if (isClosed)
|
||||
|
||||
if (pathNodeList.Count >= 3)
|
||||
{
|
||||
path.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
path.Break();
|
||||
if (isClosed)
|
||||
{
|
||||
path.Close();
|
||||
}
|
||||
else
|
||||
{
|
||||
path.Break();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -14,6 +14,11 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public string materialThemeBundleName;
|
||||
public string materialName;
|
||||
public string customTextureThemeBundleName = "None";
|
||||
public string customTextureName = "None";
|
||||
public MeshGenerator.UVMode uvMode = MeshGenerator.UVMode.UniformClip;
|
||||
public float uvRotation = 0f;
|
||||
public float size = 1f;
|
||||
public bool enableEmission;
|
||||
public float emissionIntensity;
|
||||
public bool zWrite;
|
||||
@@ -86,6 +91,9 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
meshGenerator.uvScale = uvScale;
|
||||
meshGenerator.uvOffset = uvOffset;
|
||||
meshGenerator.uvRotation = uvRotation;
|
||||
meshGenerator.uvMode = uvMode;
|
||||
meshGenerator.size = size;
|
||||
}
|
||||
}
|
||||
#endregion
|
||||
|
||||
@@ -32,8 +32,8 @@ namespace Ichni.RhythmGame
|
||||
this.splineRenderer.updateMethod = SplineUser.UpdateMethod.Update;
|
||||
this.meshRenderer.material = renderMaterial;
|
||||
this.splineRenderer.color = Color.white;
|
||||
this.splineRenderer.uvRotation = 90;
|
||||
this.splineRenderer.uvMode = MeshGenerator.UVMode.UniformClip;
|
||||
this.uvRotation = 0f;
|
||||
this.uvMode = MeshGenerator.UVMode.UniformClip;
|
||||
|
||||
SetMesh();
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ namespace Ichni.RhythmGame
|
||||
this.pathGenerator.updateMethod = SplineUser.UpdateMethod.Update;
|
||||
this.meshRenderer.material = renderMaterial;
|
||||
this.pathGenerator.color = Color.white;
|
||||
this.pathGenerator.uvRotation = 90;
|
||||
this.pathGenerator.uvMode = MeshGenerator.UVMode.UniformClip;
|
||||
this.uvRotation = 90f;
|
||||
this.uvMode = MeshGenerator.UVMode.UniformClip;
|
||||
|
||||
SetMesh();
|
||||
}
|
||||
|
||||
@@ -56,7 +56,10 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
track.trackRendererSubmodule.meshGenerator.clipFrom = tailPercent;
|
||||
track.trackRendererSubmodule.meshGenerator.clipTo = headPercent;
|
||||
track.trackRendererSubmodule.meshGenerator.RebuildImmediate();
|
||||
}
|
||||
|
||||
//track.trackPathSubmodule.path.Rebuild(true);
|
||||
}
|
||||
|
||||
public float GetTrackPercent(float songTimeInTime)
|
||||
|
||||
@@ -1,18 +1,5 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class ObjectTracker : MonoBehaviour
|
||||
{
|
||||
// Start is called before the first frame update
|
||||
void Start()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
// Update is called once per frame
|
||||
void Update()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ using UnityEngine.Serialization;
|
||||
|
||||
namespace Ichni.RhythmGame
|
||||
{
|
||||
public partial class ParticleTracker : GameElement, IHaveParticles, IHaveColorSubmodule
|
||||
public partial class ParticleTracker : GameElement, IHaveParticles, IHaveColorSubmodule, IScheduledElement
|
||||
{
|
||||
#region [暴露属性字段] Essential Configs
|
||||
public Track track;
|
||||
@@ -66,6 +66,18 @@ namespace Ichni.RhythmGame
|
||||
{
|
||||
colorSubmodule = new ColorSubmodule(this, Color.white, true, Color.white, 0);
|
||||
}
|
||||
|
||||
public override void AfterInitialize()
|
||||
{
|
||||
base.AfterInitialize();
|
||||
CoreServices.UpdateScheduler.Register(UpdatePhase.Effect, this);
|
||||
}
|
||||
|
||||
public override void OnDelete()
|
||||
{
|
||||
base.OnDelete();
|
||||
CoreServices.UpdateScheduler.Unregister(UpdatePhase.Effect, this);
|
||||
}
|
||||
#endregion
|
||||
|
||||
#region [运行时设置] Runtime Settings
|
||||
@@ -91,9 +103,8 @@ namespace Ichni.RhythmGame
|
||||
#region [轮询更新] Main Update
|
||||
public partial class ParticleTracker
|
||||
{
|
||||
private void Update()
|
||||
private void UpdateParticlePlayState(float songTime)
|
||||
{
|
||||
float songTime = CoreServices.TimeProvider.SongTime;
|
||||
if (playTime > songTime || stopTime < songTime)
|
||||
{
|
||||
particle.Stop();
|
||||
@@ -106,6 +117,15 @@ namespace Ichni.RhythmGame
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#region [IScheduledElement] Scheduler Interface
|
||||
public void ScheduledUpdate(UpdatePhase phase, float songTime)
|
||||
{
|
||||
UpdateParticlePlayState(songTime);
|
||||
}
|
||||
|
||||
public bool IsScheduledActive => isActiveAndEnabled;
|
||||
#endregion
|
||||
}
|
||||
#endregion
|
||||
|
||||
|
||||
Reference in New Issue
Block a user