Make Unity timestamps realtime critical. (2)
This commit is contained in:
@@ -50,7 +50,7 @@ namespace Cryville.Common.Unity.Input {
|
|||||||
}
|
}
|
||||||
public abstract string GetKeyName(int type);
|
public abstract string GetKeyName(int type);
|
||||||
void Update() {
|
void Update() {
|
||||||
double time = Time.timeAsDouble;
|
double time = Time.realtimeSinceStartupAsDouble;
|
||||||
foreach (var k in Keys) {
|
foreach (var k in Keys) {
|
||||||
Callback(k, 0, new InputVector(time, Vector3.zero));
|
Callback(k, 0, new InputVector(time, Vector3.zero));
|
||||||
}
|
}
|
||||||
@@ -64,7 +64,7 @@ namespace Cryville.Common.Unity.Input {
|
|||||||
void OnGUI() {
|
void OnGUI() {
|
||||||
var e = Event.current;
|
var e = Event.current;
|
||||||
if (e.keyCode == KeyCode.None) return;
|
if (e.keyCode == KeyCode.None) return;
|
||||||
double time = Time.timeAsDouble;
|
double time = Time.realtimeSinceStartupAsDouble;
|
||||||
var key = (int)e.keyCode;
|
var key = (int)e.keyCode;
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case EventType.KeyDown:
|
case EventType.KeyDown:
|
||||||
@@ -92,7 +92,7 @@ namespace Cryville.Common.Unity.Input {
|
|||||||
}
|
}
|
||||||
void OnGUI() {
|
void OnGUI() {
|
||||||
var e = Event.current;
|
var e = Event.current;
|
||||||
double time = Time.timeAsDouble;
|
double time = Time.realtimeSinceStartupAsDouble;
|
||||||
var key = e.button;
|
var key = e.button;
|
||||||
switch (e.type) {
|
switch (e.type) {
|
||||||
case EventType.MouseDown:
|
case EventType.MouseDown:
|
||||||
|
@@ -54,7 +54,7 @@ namespace Cryville.Common.Unity.Input {
|
|||||||
handler = h;
|
handler = h;
|
||||||
}
|
}
|
||||||
void Update() {
|
void Update() {
|
||||||
double time = Time.timeAsDouble;
|
double time = Time.realtimeSinceStartupAsDouble;
|
||||||
Vector3 pos = UnityCameraUtils.ScreenToWorldPoint(unity::Input.mousePosition);
|
Vector3 pos = UnityCameraUtils.ScreenToWorldPoint(unity::Input.mousePosition);
|
||||||
handler.Feed(0, 0, new InputVector(time, pos));
|
handler.Feed(0, 0, new InputVector(time, pos));
|
||||||
}
|
}
|
||||||
|
@@ -54,7 +54,7 @@ namespace Cryville.Common.Unity.Input {
|
|||||||
handler = h;
|
handler = h;
|
||||||
}
|
}
|
||||||
void Update() {
|
void Update() {
|
||||||
double time = Time.timeAsDouble;
|
double time = Time.realtimeSinceStartupAsDouble;
|
||||||
for (int i = 0; i < unity::Input.touchCount; i++) {
|
for (int i = 0; i < unity::Input.touchCount; i++) {
|
||||||
var t = unity::Input.GetTouch(i);
|
var t = unity::Input.GetTouch(i);
|
||||||
Vector2 pos = UnityCameraUtils.ScreenToWorldPoint(t.position);
|
Vector2 pos = UnityCameraUtils.ScreenToWorldPoint(t.position);
|
||||||
|
Reference in New Issue
Block a user