mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
36 lines
989 B
C#
36 lines
989 B
C#
using NewHorizons.External.Modules.VariableSize;
|
|
using NewHorizons.Utility;
|
|
using UnityEngine;
|
|
namespace NewHorizons.Components.SizeControllers
|
|
{
|
|
public class SizeController : MonoBehaviour
|
|
{
|
|
public AnimationCurve scaleCurve { get; protected set; }
|
|
public float CurrentScale { get; protected set; }
|
|
public float size = 1f;
|
|
|
|
protected void FixedUpdate()
|
|
{
|
|
if(scaleCurve != null)
|
|
{
|
|
CurrentScale = scaleCurve.Evaluate(TimeLoop.GetMinutesElapsed()) * size;
|
|
}
|
|
else
|
|
{
|
|
CurrentScale = size;
|
|
}
|
|
|
|
base.transform.localScale = Vector3.one * CurrentScale;
|
|
}
|
|
|
|
public void SetScaleCurve(TimeValuePair[] curve)
|
|
{
|
|
scaleCurve = new AnimationCurve();
|
|
foreach (var pair in curve)
|
|
{
|
|
scaleCurve.AddKey(new Keyframe(pair.time, pair.value));
|
|
}
|
|
}
|
|
}
|
|
}
|