little refactor
This commit is contained in:
@@ -1,14 +1,15 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using UnityEngine;
|
||||
|
||||
public class TimeManager : MonoBehaviour
|
||||
{
|
||||
public static TimeManager Instance { get; private set; }
|
||||
|
||||
private const float MINUTE_TIME = 0.5f;
|
||||
private const float MINUTE_TIME = 1f;
|
||||
private const float FF_TIME = 0.003f;
|
||||
|
||||
public static Action OnMinuteChanged;
|
||||
public Action OnMinuteChanged;
|
||||
public Action OnFastForwardEnd;
|
||||
|
||||
[SerializeField]
|
||||
private float _startHour;
|
||||
@@ -32,8 +33,10 @@ public class TimeManager : MonoBehaviour
|
||||
private static TimeSpan _currentTime;
|
||||
public static TimeSpan CurrentTime => _currentTime;
|
||||
|
||||
|
||||
|
||||
private TimeSpan _timeToStop;
|
||||
private Action _callBackOnFastForward;
|
||||
|
||||
private bool _isPause = false;
|
||||
|
||||
private void Awake()
|
||||
@@ -81,18 +84,17 @@ public class TimeManager : MonoBehaviour
|
||||
{
|
||||
_minuteToRealTime = MINUTE_TIME;
|
||||
_timeToStop = TimeSpan.MaxValue;
|
||||
_callBackOnFastForward?.Invoke();
|
||||
OnFastForwardEnd?.Invoke();
|
||||
}
|
||||
_timer = _minuteToRealTime;
|
||||
}
|
||||
}
|
||||
|
||||
public void FastForward(TimeSpan timeToStop,Action callBack)
|
||||
public void FastForward(TimeSpan timeToStop)
|
||||
{
|
||||
_isPause = false;
|
||||
_timeToStop = _currentTime.Add(timeToStop);
|
||||
_minuteToRealTime = 0.03f;
|
||||
_callBackOnFastForward= callBack;
|
||||
_minuteToRealTime = FF_TIME;
|
||||
}
|
||||
|
||||
private void RotateSun()
|
||||
|
||||
Reference in New Issue
Block a user