diff --git a/Assets/Scripts/GameCamera.cs b/Assets/Scripts/GameCamera.cs index 56257bd5b..e3b4cc639 100644 --- a/Assets/Scripts/GameCamera.cs +++ b/Assets/Scripts/GameCamera.cs @@ -175,7 +175,7 @@ namespace HeavenStudio UpdateCameraTranslate(); UpdateCameraRotate(); - SetShakeIntensity(); + UpdateShakeIntensity(); UpdateCameraColor(); } @@ -183,7 +183,7 @@ namespace HeavenStudio { UpdateCameraTranslate(); UpdateCameraRotate(); - SetShakeIntensity(); + UpdateShakeIntensity(); UpdateCameraColor(); } @@ -323,19 +323,20 @@ namespace HeavenStudio } } - private void SetShakeIntensity() + private void UpdateShakeIntensity() { foreach (var e in shakeEvents) { float prog = Conductor.instance.GetPositionFromBeat(e.beat, e.length); + float fac = Mathf.Cos(Time.time * 80f) * 0.5f; if (prog >= 0f) { - float fac = Mathf.Cos(Time.time * 80f) * 0.5f; - ShakeResult = new Vector3(fac * e["valA"], fac * e["valB"]); + Util.EasingFunction.Function func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease) e["ease"]); + ShakeResult = new Vector3(fac * func(e["easedA"], e["valA"], Mathf.Min(prog, 1f)), fac * func(e["easedB"], e["valB"], Mathf.Min(prog, 1f))); } if (prog > 1f) { - ShakeResult = new Vector3(0, 0); + ShakeResult = new Vector3(fac * e["valA"], fac * e["valB"]); } } } diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index 3cd418242..ffb5196b6 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -962,8 +962,14 @@ namespace HeavenStudio new GameAction("screen shake", "Screen Shake", 1f, true, new List() { - new Param("valA", new EntityTypes.Float(0, 10, 0), "Horizontal Intensity", "Set the horizontal intensity of the screen shake."), - new Param("valB", new EntityTypes.Float(0, 10, 1), "Vertical Intensity", "Set the vertical intensity of the screen shake.") + new Param("easedA", new EntityTypes.Float(0, 10, 0), "Start Horizontal Intensity", "Set the horizontal intensity of the screen shake at the start of the event."), + new Param("easedB", new EntityTypes.Float(0, 10, 0.5f), "Start Vertical Intensity", "Set the vertical intensity of the screen shake at the start of the event."), + new Param("valA", new EntityTypes.Float(0, 10, 0), "End Horizontal Intensity", "Set the horizontal intensity of the screen shake at the end of the event."), + new Param("valB", new EntityTypes.Float(0, 10, 0.5f), "End Vertical Intensity", "Set the vertical intensity of the screen shake at the end of the event."), + new("ease", Util.EasingFunction.Ease.Linear, "Ease", "Set the easing of the action.", new() + { + new((x, y) => (Util.EasingFunction.Ease)x != Util.EasingFunction.Ease.Instant, new string[] { "easedA", "easedB" }) + }), } ), new GameAction("display textbox", "Display Textbox", 1f, true, new List()