mirror of
https://github.com/Outer-Wilds-New-Horizons/new-horizons.git
synced 2025-12-11 20:15:44 +01:00
34 lines
818 B
C#
34 lines
818 B
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using UnityEngine;
|
|
|
|
namespace NewHorizons.External.VariableSize
|
|
{
|
|
public class VariableSizeModule : Module
|
|
{
|
|
public TimeValuePair[] Curve { get; set; }
|
|
|
|
public class TimeValuePair
|
|
{
|
|
public float Time { get; set; }
|
|
public float Value { get; set; }
|
|
}
|
|
|
|
public AnimationCurve ToAnimationCurve(float size = 1f)
|
|
{
|
|
var curve = new AnimationCurve();
|
|
if(Curve != null)
|
|
{
|
|
foreach (var pair in this.Curve)
|
|
{
|
|
curve.AddKey(new Keyframe(pair.Time, size * pair.Value));
|
|
}
|
|
}
|
|
return curve;
|
|
}
|
|
}
|
|
}
|