GotNoPockets / MayhemJamGameThingy / Assets / Scripts / MusicEnableScript.cs
MusicEnableScript.cs
Raw
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.UI;

public class MusicEnableScript : MonoBehaviour
{
	internal bool MusicEnabled;
	private SaveScript DataScript;

	public Sprite OnSpr;
	public Sprite OffSpr;

	private void Update()
	{
		if (MusicEnabled) { GetComponent<Image>().sprite = OnSpr; }
		else { GetComponent<Image>().sprite = OffSpr; }
	}

	public void Toggle()
	{
		MusicEnabled = !MusicEnabled;
	}
}