30 lines
638 B
C#
30 lines
638 B
C#
using UnityEngine;
|
|
|
|
public class PengaturSuara : MonoBehaviour
|
|
{
|
|
[Header("Tarik Ikon ke Sini")]
|
|
public GameObject ikonON;
|
|
public GameObject ikonOFF;
|
|
|
|
private bool statusSuara = true;
|
|
|
|
public void ToggleAudio()
|
|
{
|
|
// Balik statusnya
|
|
statusSuara = !statusSuara;
|
|
|
|
// Atur tampilan ikon
|
|
if (statusSuara)
|
|
{
|
|
ikonON.SetActive(true);
|
|
ikonOFF.SetActive(false);
|
|
Debug.Log("Suara Aktif");
|
|
}
|
|
else
|
|
{
|
|
ikonON.SetActive(false);
|
|
ikonOFF.SetActive(true);
|
|
Debug.Log("Suara Mati");
|
|
}
|
|
}
|
|
} |