Files
ichni_Official/Assets/ThemeBundles/DepartureToMultiverse/Scripts/NoteEffect/DTMNoteHoldingBreath.cs
SoulliesOfficial 6aa498f6be
2025-08-11 14:04:06 -04:00

78 lines
2.3 KiB
C#

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<ParticleSystem>();
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);
}
}
}
}