浏览代码

Added F5/F6 toggles to FPS Manager (Pause/Step)

/main
Thomas ICHÉ 5 年前
当前提交
3a1c2ada
共有 1 个文件被更改,包括 34 次插入0 次删除
  1. 34
      Assets/Scripts/Debug/FPSManager.cs

34
Assets/Scripts/Debug/FPSManager.cs


public class FPSManager : Manager
{
public KeyCode ToggleKey = KeyCode.F8;
public KeyCode PauseKey = KeyCode.F5;
public KeyCode StepKey = KeyCode.F6;
bool paused = false;
bool step = false;
private void Update()
{

if (MillisecondCounter != null)
MillisecondCounter.text = $"{((dt * 1000).ToString("F2"))}ms.";
}
if(paused)
{
if(step)
{
Time.timeScale = 1.0f;
step = false;
}
else
{
Time.timeScale = 0.0f;
}
}
else
{
Time.timeScale = 1.0f;
}
if (Input.GetKeyDown(PauseKey))
{
paused = !paused;
}
else if (Input.GetKeyDown(StepKey))
{
paused = true;
step = true;
}
}

正在加载...
取消
保存