From 4ff3ba8dfc01bdcd2f0962fc907cec4320a398a8 Mon Sep 17 00:00:00 2001 From: Firerise9402 <90978630+Firerise9402@users.noreply.github.com> Date: Thu, 17 Aug 2023 14:52:04 -0400 Subject: [PATCH] fix units --- Assets/Scripts/Minigames.cs | 4 ++-- Assets/Scripts/StaticCamera.cs | 15 ++++++++------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Minigames.cs b/Assets/Scripts/Minigames.cs index c03f0e345..8efcf62a5 100644 --- a/Assets/Scripts/Minigames.cs +++ b/Assets/Scripts/Minigames.cs @@ -715,8 +715,8 @@ namespace HeavenStudio ), new GameAction("scale letterbox", "Scale Letterbox", 1f, true, new List() { - new Param("valA", new EntityTypes.Float(0, 50, 1), "Scale Letterbox X"), - new Param("valB", new EntityTypes.Float(0, 50, 1), "Scale Letterbox Y"), + new Param("valA", new EntityTypes.Float(0, 200, 100), "Scale Letterbox X"), + new Param("valB", new EntityTypes.Float(0, 200, 100), "Scale Letterbox Y"), new Param("ease", Util.EasingFunction.Ease.Linear, "Ease Type"), new Param("axis", StaticCamera.ViewAxis.All, "Axis", "The axis to scale the letterbox in") } diff --git a/Assets/Scripts/StaticCamera.cs b/Assets/Scripts/StaticCamera.cs index 8c1f5b480..1b7f741e8 100644 --- a/Assets/Scripts/StaticCamera.cs +++ b/Assets/Scripts/StaticCamera.cs @@ -16,6 +16,7 @@ namespace HeavenStudio { [SerializeField] RectTransform canvas; [SerializeField] GameObject overlayView; + [SerializeField] RectTransform parentView; [SerializeField] Image ambientBg; [SerializeField] GameObject ambientBgGO; @@ -247,14 +248,14 @@ namespace HeavenStudio switch (e["axis"]) { case (int) ViewAxis.X: - letterbox.x = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; + letterbox.x = func(letterboxLast.x, e["valA"] * .01f * parentView.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; break; case (int) ViewAxis.Y: - letterbox.y = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + letterbox.y = func(letterboxLast.y, e["valB"] * .01f * parentView.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; break; default: - float dx = func(letterboxLast.x, e["valA"], Mathf.Min(prog, 1f)) * AspectRatioWidth; - float dy = func(letterboxLast.y, e["valB"], Mathf.Min(prog, 1f)) * AspectRatioHeight; + float dx = func(letterboxLast.x, e["valA"] * .01f * parentView.localScale.x, Mathf.Min(prog, 1f)) * AspectRatioWidth; + float dy = func(letterboxLast.y, e["valB"] * .01f * parentView.localScale.y, Mathf.Min(prog, 1f)) * AspectRatioHeight; letterbox = new Vector3(dx, dy, 1); break; } @@ -264,13 +265,13 @@ namespace HeavenStudio switch (e["axis"]) { case (int) ViewAxis.X: - letterboxLast.x = e["valA"] * AspectRatioWidth; + letterboxLast.x = e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth; break; case (int) ViewAxis.Y: - letterboxLast.y = e["valB"] * AspectRatioHeight; + letterboxLast.y = e["valB"] * .01f * parentView.localScale.y * AspectRatioHeight; break; default: - letterboxLast = new Vector3(e["valA"] * AspectRatioWidth, e["valB"] * AspectRatioHeight, 1); + letterboxLast = new Vector3(e["valA"] * .01f * parentView.localScale.x * AspectRatioWidth, e["valB"] * .01f * canvas.localScale.y * AspectRatioHeight, 1); break; } }