22 lines
603 B
C#
22 lines
603 B
C#
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
|
|
[RequireComponent(typeof(Toggle))]
|
|
public class ToggleEventReceiver : MonoBehaviour {
|
|
|
|
public string onClickPlaySEFilename;
|
|
[SerializeField]
|
|
private VibrationType vibrationType = default;
|
|
|
|
void Awake(){
|
|
GetComponent<Toggle>().onValueChanged.AddListener(result => {
|
|
if(result){
|
|
SoundManager.Instance.PlaySE(string.Format("Sounds/SE/{0}", onClickPlaySEFilename));
|
|
}
|
|
if(result){
|
|
VibrationManager.Instance.PlayVibration(vibrationType);
|
|
}
|
|
});
|
|
}
|
|
}
|