2025-06-03 02:42:28 -04:00
|
|
|
using System;
|
|
|
|
|
using System.Collections;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using Ichni.RhythmGame.Beatmap;
|
|
|
|
|
using Sirenix.OdinInspector;
|
2025-07-21 05:42:20 -04:00
|
|
|
using UniRx;
|
2025-06-03 02:42:28 -04:00
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
namespace Ichni.RhythmGame
|
|
|
|
|
{
|
2025-07-10 08:42:30 -04:00
|
|
|
public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule
|
2025-06-03 02:42:28 -04:00
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
#region [暴露属性字段] Essential Configs
|
|
|
|
|
public float time; //触发效果的时间
|
|
|
|
|
#endregion
|
|
|
|
|
|
|
|
|
|
#region [子模块接口] Submodules
|
2025-07-10 08:42:30 -04:00
|
|
|
public TransformSubmodule transformSubmodule { get; set; }
|
2025-06-03 02:42:28 -04:00
|
|
|
public EffectSubmodule effectSubmodule { get; set; }
|
2026-03-14 03:13:10 -04:00
|
|
|
#endregion
|
2025-06-03 02:42:28 -04:00
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
#region [生命周期] Lifecycle & Factory
|
2025-06-03 02:42:28 -04:00
|
|
|
public static TimeEffectsCollection GenerateElement(string name, Guid guid, List<string> tags,
|
|
|
|
|
bool isFirstGenerated, GameElement parentElement, float time)
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
TimeEffectsCollection timeEffectsCollection = Instantiate(GameManager.Instance.basePrefabs.emptyObject).AddComponent<TimeEffectsCollection>();
|
2025-06-03 02:42:28 -04:00
|
|
|
timeEffectsCollection.Initialize(name, guid, tags, isFirstGenerated, parentElement);
|
|
|
|
|
timeEffectsCollection.time = time;
|
|
|
|
|
return timeEffectsCollection;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override void SetDefaultSubmodules()
|
|
|
|
|
{
|
2025-07-10 08:42:30 -04:00
|
|
|
transformSubmodule = new TransformSubmodule(this);
|
2025-06-03 02:42:28 -04:00
|
|
|
effectSubmodule = new EffectSubmodule(this);
|
|
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
#endregion
|
2025-06-03 02:42:28 -04:00
|
|
|
|
2026-03-14 03:13:10 -04:00
|
|
|
#region [轮询更新] Main Update
|
2025-06-03 02:42:28 -04:00
|
|
|
private void Update()
|
|
|
|
|
{
|
2026-03-14 03:13:10 -04:00
|
|
|
if (!GameManager.Instance.songPlayer.isUpdating)
|
2025-08-11 14:04:06 -04:00
|
|
|
{
|
|
|
|
|
return;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (EffectBase effect in effectSubmodule.effectCollection["Prior"])
|
|
|
|
|
{
|
|
|
|
|
effect.UpdateEffect(time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (EffectBase effect in effectSubmodule.effectCollection["Default"])
|
|
|
|
|
{
|
|
|
|
|
effect.UpdateEffect(time);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
foreach (EffectBase effect in effectSubmodule.effectCollection["Late"])
|
|
|
|
|
{
|
|
|
|
|
effect.UpdateEffect(time);
|
|
|
|
|
}
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
2026-03-14 03:13:10 -04:00
|
|
|
#endregion
|
2025-06-03 02:42:28 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
}
|