using System.Collections; using System.Collections.Generic; using Ichni.Editor; 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 UpdateEffect(float triggerTime) { EffectState state = CheckEffectState(triggerTime); float songTime = EditorManager.instance.songInformation.songTime; if (state == EffectState.Before) { Recover(); if (nowEffectState != EffectState.Before) { nowEffectState = EffectState.Before; effectProgressPercent = 0; } } else if (state == EffectState.Middle) { if (nowEffectState == EffectState.Before || nowEffectState == EffectState.After) { PreExecute(); } nowEffectState = EffectState.Middle; effectProgressPercent = (songTime - triggerTime) / effectTime; Execute(); } else if (state == EffectState.After && nowEffectState != EffectState.After) { if (nowEffectState != EffectState.Middle) PreExecute(); nowEffectState = EffectState.After; effectProgressPercent = 1; Adjust(); } } public override void PreExecute() { GameObject effectPrefab = null; switch (EditorManager.instance.currentJudgeType) { case NoteBase.NoteJudgeType.Perfect: effectPrefab = noteVisual.effectPrefabList[3]; break; case NoteBase.NoteJudgeType.Good: effectPrefab = noteVisual.effectPrefabList[4]; break; case NoteBase.NoteJudgeType.Bad: effectPrefab = noteVisual.effectPrefabList[5]; break; default: return; } if (breathParticle != null) LeanPool.Despawn(breathParticle.gameObject); breathParticle = LeanPool.Spawn(effectPrefab, noteVisual.judgeEffect.transform).GetComponent(); breathParticle.Play(); } public override void Adjust() { if (breathParticle != null) breathParticle.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear); } public override EffectBase_BM ConvertToBM() { return new Beatmap.DTMNoteHoldingBreath_BM(effectTime); } public override void SetUpInspector() { IHaveInspection inspector = EditorManager.instance.uiManager.inspector; var container = inspector.GenerateContainer("Basic Note Holding Expand"); var subcontainer = container.GenerateSubcontainer(3); } } 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); } } } }