像素化
This commit is contained in:
@@ -78,7 +78,10 @@ namespace Ichni.RhythmGame
|
||||
|
||||
public override EffectBase ConvertToGameType(GameElement attachedGameElement)
|
||||
{
|
||||
return new BloomEffect(duration, peak, intensityCurve);
|
||||
return new BloomEffect(duration, peak, intensityCurve)
|
||||
{
|
||||
attachedGameElement = attachedGameElement
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,111 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using Ichni.Editor;
|
||||
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()
|
||||
{
|
||||
EditorManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
|
||||
EditorManager.instance.postProcessingManager.SetFeatureActive(false);
|
||||
}
|
||||
|
||||
public override void Disrupt()
|
||||
{
|
||||
EditorManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
|
||||
EditorManager.instance.postProcessingManager.SetFeatureActive(false);
|
||||
}
|
||||
|
||||
public override void PreExecute()
|
||||
{
|
||||
EditorManager.instance.postProcessingManager.SetFeatureActive(true);
|
||||
EditorManager.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);
|
||||
|
||||
EditorManager.instance.postProcessingManager.SetPixelateStrength(x,y);
|
||||
}
|
||||
|
||||
public override void Adjust()
|
||||
{
|
||||
EditorManager.instance.postProcessingManager.SetPixelateStrength(Screen.width, Screen.height);
|
||||
EditorManager.instance.postProcessingManager.SetFeatureActive(false);
|
||||
}
|
||||
|
||||
public override EffectBase_BM ConvertToBM()
|
||||
{
|
||||
return new PixelateEffect_BM(duration, bottomX, bottomY, intensityCurve);
|
||||
}
|
||||
|
||||
public override void SetUpInspector()
|
||||
{
|
||||
IHaveInspection inspector = EditorManager.instance.uiManager.inspector;
|
||||
var container = inspector.GenerateContainer("Pixelate Effect");
|
||||
var effectSettings = container.GenerateSubcontainer(3);
|
||||
var effectTimeField = inspector.GenerateInputField(this, effectSettings, "Effect Time", nameof(duration));
|
||||
var bottomXField = inspector.GenerateInputField(this, effectSettings, "Bottom X", nameof(bottomX));
|
||||
var bottomYField = inspector.GenerateInputField(this, effectSettings, "Bottom Y", nameof(bottomY));
|
||||
var intensityCurveButton = inspector.GenerateButton(this, effectSettings, "Intensity Curve", () =>
|
||||
{
|
||||
var intensityCurveWindow =
|
||||
inspector.GenerateCompositeParameterWindow(this, "Intensity Curve", nameof(intensityCurve)).SetAsCustomCurve();
|
||||
});
|
||||
|
||||
var clearButton = inspector.GenerateButton(this, effectSettings, "Clear Pixelate", () =>
|
||||
{
|
||||
EditorManager.instance.postProcessingManager.SetFeatureActive(false);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
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
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: b1ecccb5fd84627489e74a02a44da11a
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user