2025-05-23 06:44:50 +00:00
|
|
|
using System.Collections;
|
|
|
|
|
using UnityEngine;
|
|
|
|
|
|
|
|
|
|
public class TimeMgr : MonoBehaviourSingletonTemplate<TimeMgr>
|
|
|
|
|
{
|
|
|
|
|
private void Start()
|
|
|
|
|
{
|
|
|
|
|
DontDestroy();
|
|
|
|
|
}
|
|
|
|
|
|
2025-06-07 23:44:27 +00:00
|
|
|
public void Set_TimeScale(float delaytime = 0.025f, float _timescale = 0.05f)
|
2025-05-23 06:44:50 +00:00
|
|
|
{
|
2025-05-23 06:46:39 +00:00
|
|
|
StopCoroutine(nameof(Run_TimeScale));
|
|
|
|
|
StartCoroutine(Run_TimeScale(delaytime, _timescale));
|
2025-05-23 06:44:50 +00:00
|
|
|
}
|
|
|
|
|
|
2025-05-23 06:46:39 +00:00
|
|
|
IEnumerator Run_TimeScale(float delaytime, float _timescale)
|
2025-05-23 06:44:50 +00:00
|
|
|
{
|
|
|
|
|
Time.timeScale = _timescale;
|
|
|
|
|
yield return new WaitForSeconds(delaytime);
|
|
|
|
|
Time.timeScale = 1f;
|
|
|
|
|
}
|
|
|
|
|
}
|