81 lines
2.8 KiB
C#
81 lines
2.8 KiB
C#
|
|
using System.Collections;
|
||
|
|
using System.Collections.Generic;
|
||
|
|
using Ichni.RhythmGame.Beatmap;
|
||
|
|
using MoreMountains.Feedbacks;
|
||
|
|
using MoreMountains.FeedbacksForThirdParty;
|
||
|
|
using UnityEngine;
|
||
|
|
using UnityEngine.Rendering.Universal;
|
||
|
|
|
||
|
|
namespace Ichni.RhythmGame
|
||
|
|
{
|
||
|
|
public class VignetteEffect : EffectBase
|
||
|
|
{
|
||
|
|
public float duration;
|
||
|
|
public float peak;
|
||
|
|
public float smoothness;
|
||
|
|
public Color color;
|
||
|
|
public AnimationCurve intensityCurve;
|
||
|
|
|
||
|
|
public VignetteEffect(float duration, float peak, float smoothness, Color color, AnimationCurve intensityCurve)
|
||
|
|
{
|
||
|
|
this.effectTime = 0;
|
||
|
|
this.duration = duration;
|
||
|
|
this.peak = peak;
|
||
|
|
this.smoothness = smoothness;
|
||
|
|
this.color = color;
|
||
|
|
this.intensityCurve = intensityCurve;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override void Adjust()
|
||
|
|
{
|
||
|
|
MMF_Player effect = Lean.Pool.LeanPool.Spawn(GameManager.instance.basePrefabs.vignetteEffect).GetComponent<MMF_Player>();
|
||
|
|
effect.GetFeedbackOfType<MMF_Vignette_URP>().Duration = duration;
|
||
|
|
effect.GetFeedbackOfType<MMF_Vignette_URP>().RemapIntensityOne = peak;
|
||
|
|
effect.GetFeedbackOfType<MMF_Vignette_URP>().Intensity = intensityCurve;
|
||
|
|
if (GameManager.instance.postProcessingManager.globalVolume.profile.TryGet(out Vignette vignette))
|
||
|
|
{
|
||
|
|
vignette.smoothness.value = smoothness;
|
||
|
|
vignette.color.value = color;
|
||
|
|
}
|
||
|
|
effect.PlayFeedbacks();
|
||
|
|
Lean.Pool.LeanPool.Despawn(effect.gameObject, duration);
|
||
|
|
}
|
||
|
|
|
||
|
|
public override EffectBase_BM ConvertToBM()
|
||
|
|
{
|
||
|
|
return new VignetteEffect_BM(duration, peak, smoothness, color, intensityCurve);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
|
||
|
|
namespace Beatmap
|
||
|
|
{
|
||
|
|
public class VignetteEffect_BM : EffectBase_BM
|
||
|
|
{
|
||
|
|
public float duration;
|
||
|
|
public float peak;
|
||
|
|
public float smoothness;
|
||
|
|
public Color color;
|
||
|
|
public AnimationCurve intensityCurve;
|
||
|
|
|
||
|
|
public VignetteEffect_BM()
|
||
|
|
{
|
||
|
|
|
||
|
|
}
|
||
|
|
|
||
|
|
public VignetteEffect_BM(float duration, float peak, float smoothness, Color color, AnimationCurve intensityCurve)
|
||
|
|
{
|
||
|
|
this.effectTime = 0;
|
||
|
|
this.duration = duration;
|
||
|
|
this.peak = peak;
|
||
|
|
this.smoothness = smoothness;
|
||
|
|
this.color = color;
|
||
|
|
this.intensityCurve = intensityCurve;
|
||
|
|
}
|
||
|
|
|
||
|
|
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||
|
|
{
|
||
|
|
return new VignetteEffect(duration, peak, smoothness, color, intensityCurve);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|