mirror of
https://github.com/RHeavenStudio/HeavenStudio.git
synced 2025-04-30 02:54:26 +02:00

* vfx event optimization + scheduled autoplay stuff FOR RELEASE 1.1 making another commit for r2 * toggle inputs/autoplay + stretchy the days of useless stretchy toggle inputs are over. also dog ninja fix and lockstep Stop Stepping block * change order * flash beat 0 fix, toggles are ignored in strechys * km optimizations, air rally fixes * smore km stuff
59 lines
1.8 KiB
C#
59 lines
1.8 KiB
C#
using Jukebox;
|
|
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
namespace HeavenStudio
|
|
{
|
|
public class StretchCameraVFX : MonoBehaviour
|
|
{
|
|
private List<RiqEntity> _events = new();
|
|
|
|
private void Start()
|
|
{
|
|
GameManager.instance.onBeatChanged += OnBeatChanged;
|
|
}
|
|
|
|
public void OnBeatChanged(double beat)
|
|
{
|
|
_events.Clear();
|
|
foreach (var entity in GameManager.instance.Beatmap.Entities)
|
|
{
|
|
if (entity.datamodel == "vfx/stretch camera") {
|
|
_events.Add(entity);
|
|
}
|
|
}
|
|
Update();
|
|
}
|
|
|
|
private void Update()
|
|
{
|
|
float newX = 1f;
|
|
float newY = 1f;
|
|
foreach (var e in _events)
|
|
{
|
|
float normalized = Conductor.instance.GetPositionFromBeat(e.beat, e.length);
|
|
if (normalized < 0f) 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:
|
|
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;
|
|
}
|
|
}
|
|
EventCaller.instance.GamesHolder.transform.localScale = new Vector3(newX, newY, 1f);
|
|
}
|
|
}
|
|
}
|
|
|