-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathEasyTime.cs
More file actions
50 lines (44 loc) · 1.25 KB
/
EasyTime.cs
File metadata and controls
50 lines (44 loc) · 1.25 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class EasyTime : MonoBehaviour
{
[Header("Settings")]
[SerializeField] private float _Multiplier = 1;
[Header("Info")]
[SerializeField] private float _TotalTime;
[SerializeField] private float _CurrentTime;
[SerializeField] private Vector3 _TimeData;
[SerializeField] private int _Day;
void Update()
{
_CurrentTime += 1 * _Multiplier * Time.deltaTime;
_TotalTime += 1 * _Multiplier * Time.deltaTime;
_TimeData = new Vector3(_CurrentTime % 60, Mathf.Floor((_CurrentTime / 60) % 60), Mathf.Floor(_CurrentTime / 3600));
if(_TimeData.z >= 24)
{
_Day++;
_CurrentTime = 0;
}
}
public float CurrentTime_Float
{
get { return _CurrentTime; }
set { _CurrentTime = value; }
}
public float TotalTime_Flaot
{
get { return _TotalTime; }
set { _TotalTime = value; }
}
public Vector3 CurrentTime_Vector4
{
get { return _TimeData; }
set { _TimeData = value; }
}
public int CurrentDay
{
get { return _Day; }
set { _Day = value; }
}
}