10using System.Collections;
20 [RequireComponent(typeof(SpriteRenderer))]
23 [Tooltip(
"The scene LeapServiceProvider.")]
26 [Tooltip(
"How fast to make the connection notice sprite visible.")]
30 [Tooltip(
"How fast to fade out the connection notice sprite.")]
34 [Tooltip(
"The easing curve for the fade in and out effect.")]
35 public AnimationCurve
fadeCurve = AnimationCurve.EaseInOut(0.0f, 0.0f, 1.0f, 1.0f);
37 [Tooltip(
"How frequently to check the connection.")]
40 [Tooltip(
"A tint applied to the connection notice sprite when on.")]
43 [Tooltip(
"How far to place the sprite in front of the camera.")]
46 private float fadedIn = 0.0f;
47 private SpriteRenderer spriteRenderer;
48 private bool connected =
false;
51 spriteRenderer = GetComponent<SpriteRenderer>();
53 StartCoroutine(Monitor());
56 void SetAlpha(
float alpha) {
62 Camera cam = Camera.main;
63 Vector3 pos = cam.transform.position + cam.transform.forward *
distanceToCamera;
64 transform.position = pos;
65 transform.LookAt(cam.transform);
69 private IEnumerator Monitor() {
74 while (fadedIn > 0.0) {
76 fadedIn = Mathf.Clamp(fadedIn, 0.0f, 1.0f);
81 while (fadedIn < 1.0) {
83 fadedIn = Mathf.Clamp(fadedIn, 0.0f, 1.0f);
LeapServiceProvider provider
The LeapServiceProvider provides tracked Leap Hand data and images from the device via the Leap servi...
bool IsConnected()
Returns true if the Leap Motion hardware is plugged in and this application is connected to the Leap ...