void Awake() { try { HFTGlobalSoundHelper.GetSounds(); } catch (System.Exception) { Debug.LogError("No HFTGlobalSoundHelper in scene. Please add one"); } m_gamepad = GetComponent <HFTGamepad>(); }
void Start() { NetPlayer netPlayer = m_gamepad.NetPlayer; if (netPlayer != null) { netPlayer.SendCmd("loadSounds", new MessageLoadSounds(HFTGlobalSoundHelper.GetSounds())); } }
IEnumerator Play() { HFTSounds.Sounds sounds = HFTGlobalSoundHelper.GetSounds(); string[] soundNames = new string[sounds.Keys.Count]; sounds.Keys.CopyTo(soundNames, 0); int index = 0; while (true) { yield return(new WaitForSeconds(1.0f)); m_soundPlayer.PlaySound(soundNames[index]); index = (index + 1) % soundNames.Length; } }