summaryrefslogtreecommitdiff
path: root/Client/Assets/Scripts/XUtliPoolLib/XElapseTimer.cs
blob: 1208b5f6327702eb85d651cbf686bf528cf314b1 (plain)
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
51
52
53
54
55
56
57
58
59
using System;
using UnityEngine;

namespace XUtliPoolLib
{
	public class XElapseTimer
	{
		public float LeftTime
		{
			get
			{
				return this.m_LeftTime;
			}
			set
			{
				this.m_LeftTime = value;
				this.m_OriLeftTime = this.m_LeftTime;
				this.m_LastTime = -1f;
				this.m_PassTime = 0f;
			}
		}

		public float PassTime
		{
			get
			{
				return this.m_PassTime;
			}
		}

		private float m_OriLeftTime = 0f;

		private float m_LeftTime = 0f;

		private float m_LastTime = -1f;

		private float m_PassTime = 0f;

		public void Update()
		{
			this.m_PassTime = 0f;
			bool flag = this.m_LastTime < 0f;
			if (flag)
			{
				this.m_LastTime = Time.time;
			}
			else
			{
				this.m_PassTime = Time.time - this.m_LastTime;
			}
			this.m_LeftTime = this.m_OriLeftTime - this.m_PassTime;
			bool flag2 = this.m_LeftTime < 0f;
			if (flag2)
			{
				this.m_LeftTime = 0f;
			}
		}
	}
}