using System.Collections;
using System.Collections.Generic;
using UnityEngine;
public class music : MonoBehaviour
{
AudioSource myaudio;
bool flag = true;
// Use this for initialization
void Start()
{
myaudio = GetComponent<AudioSource>();
}
void OnMouseDown() {
if (flag)
{
myaudio.Play();
flag = false;
}
else
{
myaudio.Pause();
flag = true;
}
}
// Update is called once per frame
void Update()
{
//if (Input.GetMouseButtonUp(0))
// if (flag)
// {
// myaudio.Play();
// flag = false;
// }
// else
// {
// myaudio.Pause();
// flag = true;
// }
//if (Input.GetMouseButtonUp(1))
//{
// myaudio.Stop();
// flag = true;
//}
}
}
using System.Collections.Generic;
using UnityEngine;
public class music : MonoBehaviour
{
AudioSource myaudio;
bool flag = true;
// Use this for initialization
void Start()
{
myaudio = GetComponent<AudioSource>();
}
void OnMouseDown() {
if (flag)
{
myaudio.Play();
flag = false;
}
else
{
myaudio.Pause();
flag = true;
}
}
// Update is called once per frame
void Update()
{
//if (Input.GetMouseButtonUp(0))
// if (flag)
// {
// myaudio.Play();
// flag = false;
// }
// else
// {
// myaudio.Pause();
// flag = true;
// }
//if (Input.GetMouseButtonUp(1))
//{
// myaudio.Stop();
// flag = true;
//}
}
}