29 lines
648 B
C#
Executable File
29 lines
648 B
C#
Executable File
using System.Collections;
|
|
using System.Collections.Generic;
|
|
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 one Instance");
|
|
Destroy(gameObject);
|
|
}
|
|
}
|
|
void Update()
|
|
{
|
|
CurrentTime += Time.deltaTime;
|
|
}
|
|
}
|