Files
ichni_Official/Assets/Scripts/Game/GameElements/GeneralEffects/PixelateEffect.cs
SoulliesOfficial e483cfe502 update
2025-07-10 08:42:30 -04:00

90 lines
3.1 KiB
C#

using System.Collections;
using System.Collections.Generic;
using Ichni.RhythmGame.Beatmap;
using UnityEngine;
namespace Ichni.RhythmGame
{
public class PixelateEffect : EffectBase
{
public float duration;
public float bottomX;
public float bottomY;
public AnimationCurve intensityCurve;
public PixelateEffect(float duration, float bottomX, float bottomY, AnimationCurve intensityCurve)
{
this.effectTime = duration;
this.duration = duration;
this.bottomX = bottomX;
this.bottomY = bottomY;
this.intensityCurve = intensityCurve;
}
public override void Recover()
{
GameManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
GameManager.instance.postProcessingManager.SetFeatureActive(false);
}
public override void Disrupt()
{
GameManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
GameManager.instance.postProcessingManager.SetFeatureActive(false);
}
public override void PreExecute()
{
GameManager.instance.postProcessingManager.SetFeatureActive(true);
GameManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
}
public override void Execute()
{
float x = Mathf.Lerp(Screen.width, bottomX, intensityCurve.Evaluate(effectProgressPercent));
float y = Mathf.Lerp(Screen.height, bottomY, intensityCurve.Evaluate(effectProgressPercent));
Debug.Log(x + ", " + y);
GameManager.instance.postProcessingManager.SetPixelateStrength(x,y);
}
public override void Adjust()
{
GameManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
GameManager.instance.postProcessingManager.SetFeatureActive(false);
}
public override EffectBase_BM ConvertToBM()
{
return new PixelateEffect_BM(duration, bottomX, bottomY, intensityCurve);
}
}
namespace Beatmap
{
public class PixelateEffect_BM : EffectBase_BM
{
public float duration;
public float bottomX;
public float bottomY;
public AnimationCurve intensityCurve;
public PixelateEffect_BM(float duration, float bottomX, float bottomY, AnimationCurve intensityCurve)
{
this.effectTime = duration;
this.duration = duration;
this.bottomX = bottomX;
this.bottomY = bottomY;
this.intensityCurve = intensityCurve;
}
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
{
return new PixelateEffect(duration, bottomX, bottomY, intensityCurve)
{
attachedGameElement = attachedGameElement
};
}
}
}
}