add project files
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
using UnityEngine;
|
||||
using UnityEngine.UI;
|
||||
|
||||
public class ButtonClickSound : MonoBehaviour
|
||||
{
|
||||
public bool collectButton;
|
||||
|
||||
private void Start()
|
||||
{
|
||||
ButtonSoundsController controller = ButtonSoundsController.Instance;
|
||||
if (controller == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
Button button = GetComponent<Button>();
|
||||
if (button != null)
|
||||
{
|
||||
button.onClick.AddListener(controller.OnButtonClick);
|
||||
return;
|
||||
}
|
||||
Toggle toggle = GetComponent<Toggle>();
|
||||
if (toggle != null)
|
||||
{
|
||||
toggle.onValueChanged.AddListener(delegate
|
||||
{
|
||||
controller.OnButtonClick();
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user