Files
ichni_Creator_Studio/Assets/ThemeBundles/DepartureToMultiverse/Scripts/NoteEffect/DTMNoteHoldingBreath.cs
TRAfoer 7a2bc844bd 我死去
目前添加了一个能够深度查找和设置反射的helper,但是Tag的系统仍然不完全,另外我觉得console可以重构了

Signed-off-by: TRAfoer <lhf190@outlook.com>
2025-12-14 12:15:07 +08:00

123 lines
4.0 KiB
C#

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