using Ichni.RhythmGame.Beatmap; using Lean.Pool; using UnityEngine; namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse { public class DTMNoteHoldingBreath : NoteHoldingEffect { private ParticleSystem breathParticle; public DTMNoteHoldingBreath(DTMNoteVisualHold noteVisual) { this.note = noteVisual.note; this.noteVisual = noteVisual; this.effectTime = GetHoldingTime(); } 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); } public override EffectBase_BM ConvertToBM() { return new Beatmap.DTMNoteHoldingBreath_BM(effectTime); } } namespace Beatmap { public class DTMNoteHoldingBreath_BM : NoteHoldingEffect_BM { public DTMNoteHoldingBreath_BM() { } public DTMNoteHoldingBreath_BM(float effectTime) : base(effectTime) { } public override EffectBase ConvertToGameType(GameElement attachedGameElement) { return new DTMNoteHoldingBreath(attachedGameElement as DTMNoteVisualHold); } } } }