VbtnFa.cs
1.25 KB
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
45
46
47
48
49
50
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using Vuforia;
public class VbtnFa : MonoBehaviour, IVirtualButtonEventHandler
{
VirtualButtonBehaviour virtualButtonBehaviour;
private AudioSource sound;
public GameObject ps;
public GameObject star;
// Start is called before the first frame update
void Start()
{
virtualButtonBehaviour = GetComponentInChildren<VirtualButtonBehaviour>();
virtualButtonBehaviour.RegisterEventHandler(this);
Debug.Log("command reached in the expected position");
sound = GetComponent<AudioSource>();
ps = GameObject.Find("PsFa");
ps.SetActive(false);
star = GameObject.Find("StarFa");
star.SetActive(false);
}
public void OnButtonPressed(VirtualButtonBehaviour vb)
{
sound.Play();
ps.SetActive(true);
star.SetActive(true);
print("*** button Pressed " + vb.VirtualButtonName);
}
public void OnButtonReleased(VirtualButtonBehaviour vb)
{
ps.SetActive(false);
star.SetActive(false);
print("*** button Released " + vb.VirtualButtonName);
}
// Update is called once per frame
void Update()
{
}
}