using System.Collections; using System.Collections.Generic; using System.Linq; using Ichni.RhythmGame.Beatmap; using Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse.Beatmap; using UnityEngine; namespace Ichni.RhythmGame.ThemeBundles.DepartureToMultiverse { public class DTMNoteMissTransparent : NoteMissEffect { public List noteRenderers; public DTMNoteMissTransparent(NoteVisualBase noteVisual, float effectTime) { this.note = noteVisual.note; this.noteVisual = noteVisual; this.effectTime = effectTime; this.noteRenderers = new List(); foreach (GameObject part in noteVisual.notePartList) { Renderer rend = part.GetComponent(); if(rend != null) { noteRenderers.Add(rend); } } if (noteVisual is DTMNoteVisualHold) { this.effectTime *= 2f; } } public override void Recover() { noteVisual.noteMain.SetActive(true); foreach (var renderer in noteRenderers) { renderer.materials.For(m => m.SetFloat("_MainAlpha", 1f)); } } public override void PreExecute() { if (noteVisual is DTMNoteVisualHold) { noteRenderers[0].materials[1].SetFloat("_GlowIntensity", 0.25f); } } public override void Execute() { float e = AnimationCurveEvaluator.Evaluate(AnimationCurveType.OutQuad, effectProgressPercent); float alpha = (1 - e) / 3f; foreach (var renderer in noteRenderers) { renderer.materials.For(m => m.SetFloat("_MainAlpha", alpha)); } } public override void Adjust() { noteVisual.noteMain.SetActive(false); foreach (var renderer in noteRenderers) { renderer.materials.For(m => m.SetFloat("_MainAlpha", 1f)); } } public override EffectBase_BM ConvertToBM() { return new DTMNoteMissTransparent_BM(effectTime); } } namespace Beatmap { public class DTMNoteMissTransparent_BM : NoteMissEffect_BM { public DTMNoteMissTransparent_BM() { } public DTMNoteMissTransparent_BM(float effectTime) : base(effectTime) { } public override EffectBase ConvertToGameType(GameElement attachedGameElement) { return new DTMNoteMissTransparent(attachedGameElement as NoteVisualBase, effectTime); } } } }