コード例 #1
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
    /// <summary>
    /// Start the timer from a specific time
    /// </summary>
    /// <param name="startTime">The time the timer will start at</param>
    public virtual void Start(System.TimeSpan startTime)
    {
        timerState  = TimerState.Running;
        currentTime = startTime;

        if (timerCoroutine == null && !shuttingDown)
        {
            timerCoroutine = TimerCoroutineManager.Instance.StartCoroutine(CoroutineTime());
        }
    }
コード例 #2
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
    /// <summary>
    /// Update the timer every frame if the timer is running
    /// This function should be called in an update function
    /// </summary>
    protected virtual void UpdateTime()
    {
        if (timerState != TimerState.Running)
        {
            return;
        }

        currentTime = currentTime.val.Add(System.TimeSpan.FromSeconds(Time.deltaTime));

        timerUpdateEvent?.Invoke();
    }
コード例 #3
0
 /// <summary>
 /// Create a new time split
 /// </summary>
 /// <param name="start">The time the split started</param>
 /// <param name="finish">The time the split finished</param>
 public TimerSplit(System.TimeSpan start, System.TimeSpan finish)
 {
     splitTime   = finish - start;
     splitStart  = start;
     splitFinish = finish;
 }
コード例 #4
0
 set => SetValue(TimeSpanProperty, value);
コード例 #5
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
 /// <summary>
 /// Reset the timer to the time that is was started at
 /// </summary>
 public virtual void Reset()
 {
     currentTime = new System.TimeSpan(0);
     timerUpdateEvent?.Invoke();
 }
コード例 #6
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
 /// <summary>
 /// Time overloaded constructor
 /// </summary>
 public Timer(System.TimeSpan time)
 {
     currentTime = time;
 }
コード例 #7
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
 /// <summary>
 /// Manual overloaded constructor
 /// </summary>
 public Timer(int days = 0, int hours = 0, int minutes = 0, int seconds = 0, int milliseconds = 0)
 {
     currentTime = new System.TimeSpan(days, hours, minutes, seconds, milliseconds);
 }
コード例 #8
0
ファイル: Timer.cs プロジェクト: EthanNichols/Unity-Plugins
 /// <summary>
 /// Default constructor
 /// </summary>
 public Timer()
 {
     currentTime = new System.TimeSpan(0);
 }
コード例 #9
0
 /// <summary>
 /// Sets the <see cref="TimeSpanValue"/>.
 /// </summary>
 /// <param name="index">The index of the <see cref="TimeSpanProperty"/>.</param>
 public virtual void SetTimeSpanValue(int index)
 {
     TimeSpanValue = EnumExtensions.GetByIndex <TimeSpanProperty>(index);
 }