Tanoda
SimpleInteractionEmission.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
9
using
Leap
.
Unity
.
Interaction
;
10
using
System.Collections;
11
using
System.Collections.Generic;
12
using
UnityEngine
;
13
14
namespace
Leap.Unity.Examples
{
15
16
[AddComponentMenu(
""
)]
17
[RequireComponent(typeof(
InteractionBehaviour
))]
18
public
class
SimpleInteractionEmission
: MonoBehaviour {
19
20
public
Color
nonPrimaryHoverEmission
=
Color
.black;
21
public
Color
primaryHoverEmission
=
Color
.white;
22
23
private
Material _material;
24
private
int
_emissionColorId;
25
26
private
InteractionBehaviour
_intObj;
27
28
private
Color
_targetColor;
29
30
void
Start() {
31
var renderer = GetComponentInChildren<Renderer>();
32
if
(renderer !=
null
) {
33
_material = renderer.material;
34
_emissionColorId = Shader.PropertyToID(
"_EmissionColor"
);
35
}
36
37
_intObj = GetComponent<InteractionBehaviour>();
38
}
39
40
void
Update() {
41
_targetColor =
nonPrimaryHoverEmission
;
42
43
if
(_intObj.
isPrimaryHovered
) {
44
_targetColor =
primaryHoverEmission
;
45
}
46
47
_material.SetColor(_emissionColorId,
Color
.Lerp(_material.GetColor(_emissionColorId), _targetColor, 20F * Time.deltaTime));
48
}
49
50
}
51
52
}
Color
UnityEngine.Color Color
Definition:
TestScript.cs:32
Leap.Unity.Examples.SimpleInteractionEmission
Definition:
SimpleInteractionEmission.cs:18
Leap.Unity.Examples.SimpleInteractionEmission.nonPrimaryHoverEmission
Color nonPrimaryHoverEmission
Definition:
SimpleInteractionEmission.cs:20
Leap.Unity.Examples.SimpleInteractionEmission.primaryHoverEmission
Color primaryHoverEmission
Definition:
SimpleInteractionEmission.cs:21
Leap.Unity.Interaction.InteractionBehaviour
InteractionBehaviours are components that enable GameObjects to interact with interaction controllers...
Definition:
InteractionBehaviour.cs:36
Leap.Unity.Interaction.InteractionBehaviour.isPrimaryHovered
bool isPrimaryHovered
Gets whether this object is the primary hover for any interaction controller.
Definition:
InteractionBehaviour.cs:89
Leap.Unity.Examples
Definition:
InertiaPostProcessProvider.cs:12
Leap.Unity.Interaction
Definition:
MovePoseExample.cs:11
Leap.Unity
Definition:
AssetFolderPropertyDrawer.cs:15
Leap
Definition:
AssetFolderPropertyDrawer.cs:15
UnityEngine
Definition:
HSVPicker/UtilityScripts/BoxSlider.cs:7
Source
Assets
Plugins
LeapMotion
Modules
InteractionEngine
Examples
Common Example Assets
Scripts
SimpleInteractionEmission.cs
Generated by
1.9.3