using System; using System.Collections; using System.Collections.Generic; using Ichni.RhythmGame.Beatmap; using Sirenix.OdinInspector; using UniRx; using UnityEngine; namespace Ichni.RhythmGame { public partial class TimeEffectsCollection : GameElement, IHaveTransformSubmodule, IHaveEffectSubmodule { public TransformSubmodule transformSubmodule { get; set; } public EffectSubmodule effectSubmodule { get; set; } public float time; //触发效果的时间 public static TimeEffectsCollection GenerateElement(string name, Guid guid, List tags, bool isFirstGenerated, GameElement parentElement, float time) { TimeEffectsCollection timeEffectsCollection = Instantiate(GameManager.instance.basePrefabs.emptyObject).AddComponent(); timeEffectsCollection.Initialize(name, guid, tags, isFirstGenerated, parentElement); timeEffectsCollection.time = time; return timeEffectsCollection; } public override void SetDefaultSubmodules() { transformSubmodule = new TransformSubmodule(this); effectSubmodule = new EffectSubmodule(this); } private void Update() { effectSubmodule.effectCollection["Prior"].ForEach(effect => effect.UpdateEffect(time)); effectSubmodule.effectCollection["Default"].ForEach(effect => effect.UpdateEffect(time)); } } public partial class TimeEffectsCollection { public override void SaveBM() { matchedBM = new TimeEffectsCollection_BM(elementName, elementGuid, tags, parentElement.matchedBM as GameElement_BM, this); } } namespace Beatmap { public class TimeEffectsCollection_BM : GameElement_BM { public float time; public TimeEffectsCollection_BM() { } public TimeEffectsCollection_BM(string elementName, Guid elementGuid, List tags, GameElement_BM attachedElement, TimeEffectsCollection timeEffectsCollection) : base(elementName, elementGuid, tags, attachedElement) { time = timeEffectsCollection.time; } public override void ExecuteBM() { matchedElement = TimeEffectsCollection.GenerateElement(elementName, elementGuid, tags, false, GetElement(attachedElementGuid), time); } public override GameElement DuplicateBM(GameElement attached) { return TimeEffectsCollection.GenerateElement(elementName, elementGuid, tags, false, attached, time); } } } }