-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmusicHandle.cs
44 lines (30 loc) · 976 Bytes
/
musicHandle.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
using UnityEngine;
using System.Collections;
using VRWidgets;
public class musicHandle : SliderHandleBase
{
public GameObject activeBar = null;
public GameObject onPlay;//추가부2
private void UpdateActiveBar()
{
onPlay = GameObject.Find ("track1");//추가부3
if (activeBar)
{
activeBar.transform.localPosition = (transform.localPosition + lowerLimit.transform.localPosition) / 2.0f;
Vector3 activeBarScale = activeBar.transform.localScale;
activeBarScale.x = Mathf.Abs(transform.localPosition.x - lowerLimit.transform.localPosition.x);
activeBar.transform.localScale = activeBarScale;
onPlay.GetComponent<AudioSource> ().time = (activeBarScale.x)/4.0f * 230; //track1의 시간... peanutbutterjelly 203초
}
}
public override void UpdatePosition(Vector3 displacement)
{
base.UpdatePosition(displacement);
UpdateActiveBar();
}
public override void Awake()
{
base.Awake();
UpdateActiveBar();
}
}