AR Design
UBC EML collab with UBC SALA - visualizing IoT data in AR
CycleUniformScale.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 
4 using UnityEngine;
5 using System.Collections;
6 using HoloToolkit.Unity;
7 
8 namespace HoloToolkit.Examples.Prototyping
9 {
14  public class CycleUniformScale : CycleArray<float>
15  {
16  private Vector3 StartScale;
17  private bool isFirstCall = true;
18 
19  private ScaleToValue mScaler;
20 
21  protected override void Awake()
22  {
23  mScaler = GetComponent<ScaleToValue>();
24 
25  base.Awake();
26  }
27 
28  public override void SetIndex(int index)
29  {
30  base.SetIndex(index);
31 
32  if (isFirstCall)
33  {
34  StartScale = TargetObject.transform.localScale;
35  isFirstCall = false;
36  }
37 
38  float item = Current;
39 
40  if (mScaler != null)
41  {
42  mScaler.TargetValue = item * StartScale;
43  mScaler.StartRunning();
44  }
45  else
46  {
47  TargetObject.transform.localScale = item * StartScale;
48  }
49  }
50  }
51 }
CycleArray is a class for incrementing through component properties sequentially or assigning specifi...
Definition: CycleArray.cs:15
void StartRunning()
Start the animation
Definition: ScaleToValue.cs:66
Animates the scaling of an object with eases
Definition: ScaleToValue.cs:14
override void SetIndex(int index)
Assign a specific element from the array. Place your custom logic to assign an element to TargetObjec...
Uniformly scales an object using a float based on the selected value from the array Supports ScaleToV...
override void Awake()
set the default TargetObject