修改FPS控制

This commit is contained in:
2025-05-28 23:45:19 +08:00
parent 8e7afd9ea1
commit cdcb007d6d
18 changed files with 1012 additions and 54 deletions

View File

@@ -0,0 +1,40 @@
using System;
using System.Collections;
using UnityEngine;
namespace NBF
{
[Serializable]
public class LerpControlledBob
{
public float BobDuration;
public float BobAmount;
private float m_Offset;
public float Offset()
{
return m_Offset;
}
public IEnumerator DoBobCycle()
{
float t2 = 0f;
while (t2 < BobDuration)
{
m_Offset = Mathf.Lerp(0f, BobAmount, t2 / BobDuration);
t2 += Time.deltaTime;
yield return new WaitForFixedUpdate();
}
t2 = 0f;
while (t2 < BobDuration)
{
m_Offset = Mathf.Lerp(BobAmount, 0f, t2 / BobDuration);
t2 += Time.deltaTime;
yield return new WaitForFixedUpdate();
}
m_Offset = 0f;
}
}
}