diff --git a/Assets/PostProcessingVFX/GameCameraProfile.asset b/Assets/PostProcessingVFX/GameCameraProfile.asset index 22b7f02b2..39aaab904 100644 --- a/Assets/PostProcessingVFX/GameCameraProfile.asset +++ b/Assets/PostProcessingVFX/GameCameraProfile.asset @@ -26,10 +26,10 @@ MonoBehaviour: overrideState: 1 value: 1 centerX: - overrideState: 0 + overrideState: 1 value: 0 centerY: - overrideState: 0 + overrideState: 1 value: 0 scale: overrideState: 0 @@ -1394,7 +1394,7 @@ MonoBehaviour: overrideState: 1 value: {r: 0, g: 0, b: 0, a: 1} center: - overrideState: 0 + overrideState: 1 value: {x: 0.5, y: 0.5} intensity: overrideState: 1 diff --git a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs index 1d2f67bab..10167ceca 100644 --- a/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs +++ b/Assets/Scripts/LevelEditor/EventSelector/GridGameSelector.cs @@ -10,11 +10,9 @@ using DG.Tweening; using Starpelly; using HeavenStudio.Editor.Track; -using System.Text; namespace HeavenStudio.Editor { - // I hate the antichrist. public class GridGameSelector : MonoBehaviour { public Minigames.Minigame SelectedMinigame; diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 733a09efa..3618d0259 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -523,6 +523,7 @@ namespace HeavenStudio public EventCallback inactiveFunction = delegate { }; public EventCallback preFunction = delegate { }; public float preFunctionLength = 2.0f; + public string categoryName = string.Empty; /// /// Creates a block that can be used in the editor. The block's function and attributes are defined in the parentheses. @@ -540,7 +541,7 @@ namespace HeavenStudio /// Prevents the block from being shown in the game list. Block will still function normally if it is in the timeline. /// Runs two beats before this event is reached. /// Priority of this event. Higher priority events will be run first. - public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback prescheduleFunction = null, bool hidden = false, EventCallback preFunction = null, int priority = 0, float preFunctionLength = 2.0f) + public GameAction(string actionName, string displayName, float defaultLength = 1, bool resizable = false, List parameters = null, EventCallback function = null, EventCallback inactiveFunction = null, EventCallback prescheduleFunction = null, bool hidden = false, EventCallback preFunction = null, int priority = 0, float preFunctionLength = 2.0f, string categoryName = null) { this.actionName = actionName; if (displayName == String.Empty) this.displayName = actionName; @@ -555,6 +556,7 @@ namespace HeavenStudio this.preFunction = prescheduleFunction ?? delegate { }; this.priority = priority; this.preFunctionLength = preFunctionLength; + this.categoryName = categoryName; //todo: converting to new versions of GameActions @@ -932,6 +934,22 @@ namespace HeavenStudio }), } }, + new GameAction("vignetteCenter", "Vignette Center") + { + resizable = true, + parameters = new() + { + new("x1", new EntityTypes.Float(-1f, 2f, 0.5f), "Start X"), + new("y1", new EntityTypes.Float(-1f, 2f, 0.5f), "Start Y"), + new("x2", new EntityTypes.Float(-1f, 2f, 0.5f), "End X"), + new("y2", new EntityTypes.Float(-1f, 2f, 0.5f), "End Y"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis"), + new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new() + { + new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "x1", "y1" }) + }), + } + }, new GameAction("cabb", "Chromatic Abberation") { resizable = true, @@ -990,6 +1008,22 @@ namespace HeavenStudio }), } }, + new GameAction("lensDCenter", "Lens Distortion Center") + { + resizable = true, + parameters = new() + { + new("x1", new EntityTypes.Float(-1f, 1, 0), "Start X"), + new("y1", new EntityTypes.Float(-1f, 1, 0), "Start Y"), + new("x2", new EntityTypes.Float(-1f, 1, 0), "End X"), + new("y2", new EntityTypes.Float(-1f, 1, 0), "End Y"), + new Param("axis", StaticCamera.ViewAxis.All, "Axis"), + new("ease", Util.EasingFunction.Ease.Linear, "Ease", "", new() + { + new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "x1", "y1" }) + }), + } + }, new GameAction("grain", "Grain") { resizable = true, diff --git a/Assets/Scripts/PostProcessingVFX.cs b/Assets/Scripts/PostProcessingVFX.cs index 09d75aad9..fb4c04acd 100644 --- a/Assets/Scripts/PostProcessingVFX.cs +++ b/Assets/Scripts/PostProcessingVFX.cs @@ -12,9 +12,11 @@ namespace HeavenStudio // events private List _vignettes = new(); + private List _vignetteCenters = new(); private List _cabbs = new(); private List _blooms = new(); private List _lensDs = new(); + private List _lensDCenters = new(); private List _grains = new(); private List _colorGradings = new(); @@ -31,9 +33,11 @@ namespace HeavenStudio public void OnBeatChanged(double beat) { _vignettes = EventCaller.GetAllInGameManagerList("vfx", new string[] { "vignette" }); + _vignetteCenters = EventCaller.GetAllInGameManagerList("vfx", new string[] { "vignetteCenter" }); _cabbs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "cabb" }); _blooms = EventCaller.GetAllInGameManagerList("vfx", new string[] { "bloom" }); _lensDs = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensD" }); + _lensDCenters = EventCaller.GetAllInGameManagerList("vfx", new string[] { "lensDCenter" }); _grains = EventCaller.GetAllInGameManagerList("vfx", new string[] { "grain" }); _colorGradings = EventCaller.GetAllInGameManagerList("vfx", new string[] { "colorGrading" }); @@ -86,6 +90,36 @@ namespace HeavenStudio float newRoundness = func(e["roundStart"], e["roundEnd"], clampNormal); v.roundness.Override(newRoundness); } + + if (!v.enabled) return; + v.center.Override(new Vector2(0.5f, 0.5f)); + foreach (var e in _vignetteCenters) + { + float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + if (normalized < 0) break; + + float clampNormal = Mathf.Clamp01(normalized); + var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]); + + float newX = 0.5f; + float newY = 0.5f; + + switch ((StaticCamera.ViewAxis)e["axis"]) + { + case StaticCamera.ViewAxis.All: + newX = func(e["x1"], e["x2"], clampNormal); + newY = func(e["y1"], e["y2"], clampNormal); + break; + case StaticCamera.ViewAxis.X: + newX = func(e["x1"], e["x2"], clampNormal); + break; + case StaticCamera.ViewAxis.Y: + newY = func(e["y1"], e["y2"], clampNormal); + break; + } + + v.center.Override(new Vector2(newX, newY)); + } } private void UpdateChromaticAbberations() @@ -162,6 +196,38 @@ namespace HeavenStudio float newY = func(e["yStart"], e["yEnd"], clampNormal); l.intensityY.Override(newY); } + + if (!l.enabled) return; + l.centerX.Override(0); + l.centerY.Override(0); + foreach (var e in _lensDCenters) + { + float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + if (normalized < 0) break; + + float clampNormal = Mathf.Clamp01(normalized); + var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]); + + float newX = 0; + float newY = 0; + + switch ((StaticCamera.ViewAxis)e["axis"]) + { + case StaticCamera.ViewAxis.All: + newX = func(e["x1"], e["x2"], clampNormal); + newY = func(e["y1"], e["y2"], clampNormal); + break; + case StaticCamera.ViewAxis.X: + newX = func(e["x1"], e["x2"], clampNormal); + break; + case StaticCamera.ViewAxis.Y: + newY = func(e["y1"], e["y2"], clampNormal); + break; + } + + l.centerX.Override(newX); + l.centerY.Override(newY); + } } private void UpdateGrain()