using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse { public class DTMNoteHoldingBreath : NoteHoldingEffect { #region [效果属性与状态] Effect Fields & States private ParticleSystem breathParticle; #endregion #region [初始化] Initialization public DTMNoteHoldingBreath(DTMNoteVisualHold noteVisual) { this.note = noteVisual.note; this.noteVisual = noteVisual; this.effectTime = GetHoldingTime(); } #endregion #region [效果核心实现] Core Effect Implementation public override void Recover() { if(breathParticle != null) LeanPool.Despawn(breathParticle.gameObject); } public override void PreExecute() { GameObject effectPrefab; if ((note as Hold).preJudgeType == NoteBase.NoteJudgeType.Perfect) { effectPrefab = noteVisual.effectPrefabList[3]; } else if ((note as Hold).preJudgeType == NoteBase.NoteJudgeType.Good) { effectPrefab = noteVisual.effectPrefabList[4]; } else if ((note as Hold).preJudgeType == NoteBase.NoteJudgeType.Bad) { effectPrefab = noteVisual.effectPrefabList[5]; } else { return; } breathParticle = LeanPool.Spawn(effectPrefab, noteVisual.judgeEffect.transform).GetComponent(); breathParticle.Play(); } public override void Adjust() { breathParticle?.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); } #endregion } }