AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
FadeInOnFocusWidget.cs
Go to the documentation of this file.
1 // Copyright (c) Microsoft Corporation. All rights reserved.
2 // Licensed under the MIT License. See LICENSE in the project root for license information.
3 
5 using System.Collections;
6 using System.Collections.Generic;
7 using UnityEngine;
8 
9 namespace HoloToolkit.Examples.InteractiveElements
10 {
14  [RequireComponent(typeof(Prototyping.FadeColors))]
16  {
17  private Prototyping.FadeColors mFadeController;
18 
22  private void Awake()
23  {
24  if (mFadeController == null)
25  {
26  mFadeController = GetComponent<Prototyping.FadeColors>();
27  }
28 
29  if (mFadeController == null)
30  {
31  Debug.LogError("FadeMaterialColor:FadeController is not set in FadeInOnFocusWidget!");
32  Destroy(this);
33  }
34  }
35 
40  public override void SetState(Interactive.ButtonStateEnum state)
41  {
42  base.SetState(state);
43 
44  if (state == Interactive.ButtonStateEnum.FocusSelected || state == Interactive.ButtonStateEnum.Focus || state == Interactive.ButtonStateEnum.Press || state == Interactive.ButtonStateEnum.PressSelected)
45  {
46  mFadeController.FadeIn();
47  }
48  else
49  {
50  mFadeController.FadeOut();
51  }
52  }
53  }
54 }
InteractiveState can exist on a child element of the game object containing the Interactive component...
override void SetState(Interactive.ButtonStateEnum state)
Fade in or out based on focus
ButtonStateEnum
A button typically has 8 potential states. We can update visual feedback based on state change...
Definition: Interactive.cs:80
An InteractiveWidget for fading in elements based on Interactive focus state
Interactive exposes basic button type events to the Unity Editor and receives messages from the Gestu...
Definition: Interactive.cs:22