using System.Collections; using System.Collections.Generic; using UnityEngine; using UnityEngine.UI; using System; public class GetDateTime : MonoBehaviour { AudioSource audioData; public AudioClip AlarmRing; bool bSound=false; bool bOnTime=false; // Use this for initialization void Start () { audioData = this.gameObject.GetComponent(); audioData.clip = AlarmRing; } // Update is called once per frame void Update () { if ((iTurnOn == 1) && (bSound == false) && (bOnTime==true)) { audioData.Play(); bSound = true; } if ((iTurnOn == 1) && (bSound == true) && (bOnTime==false)) { audioData.Stop(); bSound = false; } } }