r2mods/ilspy_dump/ror2_csproj/Wave.cs

32 lines
444 B
C#
Raw Normal View History

2024-10-04 07:26:37 +00:00
using System;
using UnityEngine;
using UnityEngine.Serialization;
[Serializable]
public struct Wave
{
public float amplitude;
public float frequency;
[FormerlySerializedAs("phase")]
public float cycleOffset;
public float period
{
get
{
return 1f / frequency;
}
set
{
frequency = 1f / value;
}
}
public float Evaluate(float t)
{
return Mathf.Sin(MathF.PI * 2f * (frequency * t + cycleOffset)) * amplitude;
}
}