r2mods/ilspy_dump/ror2_csproj/RoR2/HoverEngineDisplay.cs

28 lines
808 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using UnityEngine;
namespace RoR2;
public class HoverEngineDisplay : MonoBehaviour
{
public HoverEngine hoverEngine;
[Tooltip("The local pitch at zero engine strength")]
public float minPitch = -20f;
[Tooltip("The local pitch at max engine strength")]
public float maxPitch = 60f;
public float smoothTime = 0.2f;
public float forceScale = 1f;
private float smoothVelocity;
private void FixedUpdate()
{
Vector3 localEulerAngles = base.transform.localEulerAngles;
float x = Mathf.SmoothDampAngle(target: Mathf.LerpAngle(t: Mathf.Clamp01(hoverEngine.forceStrength / hoverEngine.hoverForce * forceScale), a: minPitch, b: maxPitch), current: localEulerAngles.x, currentVelocity: ref smoothVelocity, smoothTime: smoothTime);
base.transform.localRotation = Quaternion.Euler(x, 0f, 0f);
}
}