-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAnimationAudioHelper.cs
57 lines (45 loc) · 1.38 KB
/
AnimationAudioHelper.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
45
46
47
48
49
50
51
52
53
54
55
56
57
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;
using UnityEngine.EventSystems;
using UnityEngine.Events;
public class AnimationAudioHelper : MonoBehaviour
{
[System.Serializable]
public class MyEvent:UnityEvent<int> {}
public MyEvent onClick;
public GameObject[] gameObjectsToFlip;
public Selectable[] selectables;
public void PlayClip(AudioClip clip)
{
GameManager.GM.PlayClip(clip, .5f);
//AudioSource.PlayClipAtPoint(clip, GameManager.GM.ears.transform.position, 0.5f);
}
public void DisableGO(int which)
{
gameObjectsToFlip[which].SetActive(false);
}
public void EnableGO(int which)
{
gameObjectsToFlip[which].SetActive(true);
}
public void SelectThis(int which)
{
EventSystem.current.SetSelectedGameObject(selectables[which].gameObject);
selectables[which].OnSelect(null);
}
public void ChangeGameState(int i){
GameManager.GM.SetGameState(i);
}
//using this at the end of an animation, after interactable is turned back on.
//allows me to set the selected button from another button.
public void UpdateSelected()
{
EventSystem.current.currentSelectedGameObject.GetComponent<Selectable>().OnSelect(null);
}
public void zOnClick()
{
onClick.Invoke(1);
}
}