51 lines
1.3 KiB
C#
51 lines
1.3 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
using UnityEngine.UI;
|
|
using UnityEngine.SceneManagement;
|
|
|
|
public class manager : MonoBehaviour //library unity, agar file bisa ditempelkan di unity
|
|
{
|
|
public Sprite[] spriteMute; //array gambar suara ON/OFF
|
|
public Button buttonMute; //tombol di UI yang akan berubah gambar saat mute
|
|
|
|
// Start is called before the first frame update
|
|
|
|
void Start() //untuk menyesuaikan button on/off ketika pindah scene
|
|
{
|
|
if (SoundManager.Instance.music.mute == true)
|
|
{
|
|
buttonMute.image.sprite = spriteMute[1]; //mute
|
|
}
|
|
else
|
|
{
|
|
buttonMute.image.sprite = spriteMute[0]; //voice
|
|
}
|
|
}
|
|
|
|
// Update is called once per frame (DIHAPUS)
|
|
void Update()
|
|
{
|
|
|
|
}
|
|
|
|
public void ButtonInGame() //DIHAPUS
|
|
{
|
|
SceneManager.LoadScene(1);
|
|
}
|
|
|
|
public void ButtonMute() //utk menghidupkan/mematikan button musik
|
|
{
|
|
SoundManager.Instance.MuteSound();
|
|
//ktika button musik hidup diklik, mk akn berubah ke button mute
|
|
if (SoundManager.Instance.music.mute == true)
|
|
{
|
|
buttonMute.image.sprite = spriteMute[1]; //mute
|
|
}
|
|
else
|
|
{
|
|
buttonMute.image.sprite = spriteMute[0]; //voice
|
|
}
|
|
}
|
|
}
|