Tanoda
Detector.cs
Go to the documentation of this file.
1/******************************************************************************
2 * Copyright (C) Ultraleap, Inc. 2011-2020. *
3 * *
4 * Use subject to the terms of the Apache License 2.0 available at *
5 * http://www.apache.org/licenses/LICENSE-2.0, or another agreement *
6 * between Ultraleap and you, your company or other organization. *
7 ******************************************************************************/
8
9using UnityEngine;
11using System.Collections;
12using Leap;
13
14namespace Leap.Unity {
15
32 public class Detector : MonoBehaviour {
36 public bool IsActive{ get{ return _isActive;}}
37 private bool _isActive = false;
41 [Tooltip("Dispatched when condition is detected.")]
42 public UnityEvent OnActivate;
46 [Tooltip("Dispatched when condition is no longer detected.")]
47 public UnityEvent OnDeactivate;
48
54 public virtual void Activate(){
55 if (!IsActive) {
56 _isActive = true;
57 OnActivate.Invoke();
58 }
59 }
60
66 public virtual void Deactivate(){
67 if (IsActive) {
68 _isActive = false;
69 OnDeactivate.Invoke();
70 }
71 }
72
73 //Gizmo colors
74 protected Color OnColor = Color.green;
75 protected Color OffColor = Color.red;
76 protected Color LimitColor = Color.blue;
77 protected Color DirectionColor = Color.white;
78 protected Color NormalColor = Color.gray;
79
80 }
81}
UnityEngine.Color Color
Definition: TestScript.cs:32
UnityEvent OnActivate
Definition: Detector.cs:42
virtual void Deactivate()
Definition: Detector.cs:66
UnityEvent OnDeactivate
Definition: Detector.cs:47
Color DirectionColor
Definition: Detector.cs:77
virtual void Activate()
Definition: Detector.cs:54