Esempio n. 1
0
    /// <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);
    }
Esempio n. 2
0
    /// <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;
        }
    }
Esempio n. 3
0
    protected override void XMLNodeHandler(string id, IXMLNode xmlNode, Hashtable hashData, string errorMessage)
    {
        ImmutableDataPetAnimationSound data = new ImmutableDataPetAnimationSound(id, xmlNode, errorMessage);

        // store the data
        if (hashData.ContainsKey(id))
        {
            Debug.LogError(errorMessage + "Duplicate keys!");
        }
        else
        {
            hashData.Add(id, data);
        }
    }
Esempio n. 4
0
    /// <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);
        }
    }