mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 12:05:23 +01:00
29 lines
758 B
C#
29 lines
758 B
C#
using Newtonsoft.Json;
|
|
using UnityEngine;
|
|
|
|
namespace NewHorizons.External.Modules.VariableSize
|
|
{
|
|
[JsonObject]
|
|
public class VariableSizeModule
|
|
{
|
|
/// <summary>
|
|
/// Scale this module over time
|
|
/// </summary>
|
|
public TimeValuePair[] Curve { get; set; }
|
|
|
|
public AnimationCurve GetAnimationCurve(float size = 1f)
|
|
{
|
|
var curve = new AnimationCurve();
|
|
if (Curve != null)
|
|
foreach (var pair in Curve)
|
|
curve.AddKey(new Keyframe(pair.Time, size * pair.Value));
|
|
return curve;
|
|
}
|
|
|
|
public class TimeValuePair
|
|
{
|
|
public float Time { get; set; }
|
|
public float Value { get; set; }
|
|
}
|
|
}
|
|
} |