forked from MattRix/UnityDecompiled
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAnimationKeyTime.cs
More file actions
68 lines (68 loc) · 1.12 KB
/
Copy pathAnimationKeyTime.cs
File metadata and controls
68 lines (68 loc) · 1.12 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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
using System;
using UnityEngine;
namespace UnityEditorInternal
{
internal struct AnimationKeyTime
{
private float m_FrameRate;
private int m_Frame;
private float m_Time;
public float time
{
get
{
return this.m_Time;
}
}
public int frame
{
get
{
return this.m_Frame;
}
}
public float frameRate
{
get
{
return this.m_FrameRate;
}
}
public float frameFloor
{
get
{
return ((float)this.frame - 0.5f) / this.frameRate;
}
}
public float frameCeiling
{
get
{
return ((float)this.frame + 0.5f) / this.frameRate;
}
}
public static AnimationKeyTime Time(float time, float frameRate)
{
return new AnimationKeyTime
{
m_Time = time,
m_FrameRate = frameRate,
m_Frame = Mathf.RoundToInt(time * frameRate)
};
}
public static AnimationKeyTime Frame(int frame, float frameRate)
{
return new AnimationKeyTime
{
m_Time = (float)frame / frameRate,
m_FrameRate = frameRate,
m_Frame = frame
};
}
public bool ContainsTime(float time)
{
return time >= this.frameFloor && time < this.frameCeiling;
}
}
}