AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
Timer.cs
Go to the documentation of this file.
1
// Copyright (c) Microsoft Corporation. All rights reserved.
2
// Licensed under the MIT License. See LICENSE in the project root for license information.
3
4
namespace
HoloToolkit
.Unity
5
{
9
public
struct
Timer
10
{
11
public
int
Id
;
12
13
public
static
Timer
Invalid =
new
Timer
(0);
14
15
public
Timer
(
int
id
)
16
{
17
Id = id;
18
}
19
20
public
bool
IsActive
21
{
22
get
23
{
24
return
(Id != Invalid.
Id
) &&
TimerScheduler
.
Instance
.IsTimerActive(
this
);
25
}
26
}
27
28
public
static
Timer
Start
(
float
timeSeconds,
TimerScheduler
.
Callback
callback,
bool
loop =
false
)
29
{
30
if
(
TimerScheduler
.
IsInitialized
)
31
{
32
return
TimerScheduler
.
Instance
.StartTimer(timeSeconds, callback, loop);
33
}
34
35
return
Invalid;
36
}
37
38
public
static
Timer
StartNextFrame
(
TimerScheduler
.
Callback
callback)
39
{
40
if
(
TimerScheduler
.
IsInitialized
)
41
{
42
return
TimerScheduler
.
Instance
.StartTimer(0.0f, callback,
false
,
true
);
43
}
44
45
return
Invalid;
46
}
47
48
public
void
Stop
()
49
{
50
if
(
TimerScheduler
.
IsInitialized
)
51
{
52
TimerScheduler
.
Instance
.StopTimer(
this
);
53
Id = Invalid.
Id
;
54
}
55
}
56
}
57
}
HoloToolkit.Unity.TimerScheduler
A scheduler that manages various timers.
Definition:
TimerScheduler.cs:33
HoloToolkit.Unity.Timer.Stop
void Stop()
Definition:
Timer.cs:48
HoloToolkit.Unity.Timer
Structure that defines a timer. A timer can be scheduled through the TimerScheduler.
Definition:
Timer.cs:9
HoloToolkit.Unity.TimerScheduler.Callback
delegate void Callback()
HoloToolkit.Unity.Timer.Start
static Timer Start(float timeSeconds, TimerScheduler.Callback callback, bool loop=false)
Definition:
Timer.cs:28
HoloToolkit.Unity.Timer.Id
int Id
Definition:
Timer.cs:11
HoloToolkit.Unity.Singleton.Instance
static T Instance
Returns the Singleton instance of the classes type. If no instance is found, then we search for an in...
Definition:
Singleton.cs:26
HoloToolkit.Unity.Timer.Timer
Timer(int id)
Definition:
Timer.cs:15
HoloToolkit.Unity.Timer.StartNextFrame
static Timer StartNextFrame(TimerScheduler.Callback callback)
Definition:
Timer.cs:38
HoloToolkit
HoloToolkit.Unity.Singleton.IsInitialized
static bool IsInitialized
Returns whether the instance has been initialized or not.
Definition:
Singleton.cs:58
Assets
HoloToolkit
Utilities
Scripts
Timer.cs
Generated by
1.8.12