/// <summary> /// Play the sound using animationID. animationID needs to be converted to clipName first /// </summary> /// <returns>The animation sound.</returns> /// <param name="animationID">Animation I.</param> public string PlayAnimationSound(string animationID) { ImmutableDataPetAnimationSound animationSound = DataLoaderPetAnimationSounds.GetData(animationID); string clipName = animationSound.GetRandomClipName(); PlayClip(clipName); return(clipName); }
/// <summary> /// Plays recurring clip. This means the clip will be played every /// maxTimeBetweenRecurring. /// </summary> /// <param name="clipName">Clip name.</param> /// <param name="timer">Timer.</param> public void PlayRecurringClip(string animationID) { if (!isPlayingRecurringClip) { ImmutableDataPetAnimationSound animationSound = DataLoaderPetAnimationSounds.GetData(animationID); string clipName = animationSound.GetRandomClipName(); recurringClipName = clipName; isPlayingRecurringClip = true; } }
/// <summary> /// This will make the audio clip keep looping until stop /// </summary> /// <param name="clipName">Clip name.</param> public void PlayLoopingClip(string animationID) { //only play looping clip again if there is no looping clip right now if (string.IsNullOrEmpty(loopingClipName)) { Hashtable option = new Hashtable(); option.Add("Loop", true); ImmutableDataPetAnimationSound animationSound = DataLoaderPetAnimationSounds.GetData(animationID); string clipName = animationSound.GetRandomClipName(); loopingClipName = clipName; PlayClip(clipName, option); } }