Project_WL/Assets/Script/Mgr/TimeMgr.cs

23 lines
571 B
C#

using System.Collections;
using UnityEngine;
public class TimeMgr : MonoBehaviourSingletonTemplate<TimeMgr>
{
private void Start()
{
DontDestroy();
}
public void Set_TimeScale(float delaytime = 0.025f, float _timescale = 0.05f)
{
StopCoroutine(nameof(Run_TimeScale));
StartCoroutine(Run_TimeScale(delaytime, _timescale));
}
IEnumerator Run_TimeScale(float delaytime, float _timescale)
{
Time.timeScale = _timescale;
yield return new WaitForSeconds(delaytime);
Time.timeScale = 1f;
}
}