r2mods/ilspy_dump/ror2_csproj/RoR2/AddCurvedTorque.cs

28 lines
513 B
C#

using UnityEngine;
namespace RoR2;
public class AddCurvedTorque : MonoBehaviour
{
public AnimationCurve torqueCurve;
public Vector3 localTorqueVector;
public float lifetime;
public Rigidbody[] rigidbodies;
private float stopwatch;
private void FixedUpdate()
{
stopwatch += Time.fixedDeltaTime;
float num = torqueCurve.Evaluate(stopwatch / lifetime);
Rigidbody[] array = rigidbodies;
for (int i = 0; i < array.Length; i++)
{
array[i].AddRelativeTorque(localTorqueVector * num);
}
}
}