Screen Tiling Split into two events + Some tweaks and new vfx! (#585)

* toss boys fixed

* see saw tweaks

* fixed quiz show bug

* splashdown spawn tweaked

* split screen tiling into two different events

* screen fit added
This commit is contained in:
Rapandrasmus
2023-11-24 23:49:59 +01:00
committed by GitHub
parent b3ea97bffb
commit 0b6ad7bdca
11 changed files with 167 additions and 84 deletions

View File

@ -10,7 +10,8 @@ namespace HeavenStudio
{
private RawImage _image;
private List<RiqEntity> _events = new();
private List<RiqEntity> _tileEvents = new();
private List<RiqEntity> _scrollEvents = new();
private void Awake()
{
@ -24,14 +25,19 @@ namespace HeavenStudio
public void OnBeatChanged(double beat)
{
_events = EventCaller.GetAllInGameManagerList("vfx", new string[] { "screenTiling" });
_tileEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "screenTiling" });
_scrollEvents = EventCaller.GetAllInGameManagerList("vfx", new string[] { "scrollTiles" });
ResetUVRect();
Update();
}
private void Update()
{
foreach (var e in _events)
float newXTiles = 1;
float newYTiles = 1;
float newXScroll = 0;
float newYScroll = 0;
foreach (var e in _tileEvents)
{
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
if (normalized < 0) break;
@ -40,13 +46,45 @@ namespace HeavenStudio
var func = Util.EasingFunction.GetEasingFunction((Util.EasingFunction.Ease)e["ease"]);
float newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
float newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
float newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
float newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
_image.uvRect = new Rect(newXScroll, newYScroll, newXTiles, newYTiles);
switch ((StaticCamera.ViewAxis)e["axis"])
{
case StaticCamera.ViewAxis.All:
newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
break;
case StaticCamera.ViewAxis.X:
newXTiles = func(e["xStart"], e["xEnd"], clampNormal);
break;
case StaticCamera.ViewAxis.Y:
newYTiles = func(e["yStart"], e["yEnd"], clampNormal);
break;
}
}
foreach (var e in _scrollEvents)
{
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"]);
switch ((StaticCamera.ViewAxis)e["axis"])
{
case StaticCamera.ViewAxis.All:
newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
break;
case StaticCamera.ViewAxis.X:
newXScroll = func(e["xScrollStart"], e["xScrollEnd"], clampNormal);
break;
case StaticCamera.ViewAxis.Y:
newYScroll = func(e["yScrollStart"], e["yScrollEnd"], clampNormal);
break;
}
}
_image.uvRect = new Rect(newXScroll, newYScroll, newXTiles, newYTiles);
}
public void ResetUVRect()