Avatar SDK Local Compute Unity plugin  2.2.2
Toolset for Head 2.0 avatars generation in Unity3D
All Classes Namespaces Functions Variables Enumerations Enumerator Properties Pages
PositionControl.cs
1 /* Copyright (C) Itseez3D, Inc. - All Rights Reserved
2 * You may not use this file except in compliance with an authorized license
3 * Unauthorized copying of this file, via any medium is strictly prohibited
4 * Proprietary and confidential
5 * UNLESS REQUIRED BY APPLICABLE LAW OR AGREED BY ITSEEZ3D, INC. IN WRITING, SOFTWARE DISTRIBUTED UNDER THE LICENSE IS DISTRIBUTED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OR
6 * CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED
7 * See the License for the specific language governing permissions and limitations under the License.
8 * Written by Itseez3D, Inc. <support@avatarsdk.com>, April 2017
9 */
10 
11 using System.Collections;
12 using System.Collections.Generic;
13 using UnityEngine;
14 using UnityEngine.UI;
15 
16 
17 namespace ItSeez3D.AvatarSdk.Core
18 {
19  public enum PositionType
20  {
21  SCALE,
22  AXIS_X,
23  AXIS_Y,
24  AXIS_Z,
25  YAW,
26  PITCH,
27  ROLL,
28  }
29 
30  public class PositionControl : MonoBehaviour
31  {
32  public PositionType positionType;
33  public Slider slider;
34 
35  private float initialValue;
36 
37  public delegate void PositionValueHandler ();
38 
39  public event PositionValueHandler ValueChanged;
40 
41  public float Value { get { return slider.value; } }
42 
43  public float MinValue { get { return slider.minValue; } }
44 
45  public float MaxValue { get { return slider.maxValue; } }
46 
47  void Start ()
48  {
49  if (slider != null)
50  initialValue = slider.value;
51  ResetValue ();
52  }
53 
54  public void OnValueChanged (float value)
55  {
56  if (ValueChanged != null)
57  ValueChanged ();
58  }
59 
60  public void ResetValue ()
61  {
62  if (slider != null) {
63  slider.value = initialValue;
64  if (ValueChanged != null)
65  ValueChanged ();
66  }
67  }
68  }
69 }