Files
ichni_Official/Assets/ThemeBundles/DepartureToMultiverse/Scripts/Game/Note/NoteEffect/DTMNoteHoldingBreath.cs
SoulliesOfficial 7580c4d87c 大更
2026-03-14 03:13:10 -04:00

60 lines
1.8 KiB
C#

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<ParticleSystem>();
breathParticle.Play();
}
public override void Adjust()
{
breathParticle?.Stop(true, ParticleSystemStopBehavior.StopEmittingAndClear);
}
#endregion
}
}