Files
real-shooter/Assets/Scripts/Managers/TimeManager.cs
2022-05-04 23:50:07 +07:00

29 lines
703 B
C#
Executable File

using UnityEngine;
public class TimeManager : MonoBehaviour
{
private static TimeManager instance;
public static TimeManager Instance { get { return instance; } }
public float CurrentTime { get; private set; }
void Start()
{
if (instance == null)
{
instance = this;
instance.CurrentTime = 0f;
}
else
{
Debug.LogError("Only 1 Instance");
Destroy(gameObject);
}
}
void Update()
{
CurrentTime += Time.deltaTime;
if (CurrentTime > SettingsReader.Instance.GetSettings.TimeOut)
GlobalEventManager.SendTimeout();
}
}