private static bool parsePlayAudio(JSONAction a)
    {
        //AMTween.PlayAudio(audioSource, AMTween.Hash ("delay", getWaitTime(frameRate), "audioclip", audioClip, "loop", loop));
        Hashtable hash = new Hashtable();

        hash.Add("disable", true);
        hash.Add("delay", a.delay);
        if (a.strings.Length >= 1)
        {
            AudioClip audioClip = (AudioClip)Resources.Load(a.strings[0]);
            if (audioClip == null)
            {
                Debug.LogWarning("Animator: Could not find AudioClip '" + a.strings[0] + "'. Make sure the audio file is placed in a Resources folder!");
                return(false);
            }
            hash.Add("audioclip", audioClip);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAudio missing 'audioclip' clip name.");
            return(false);
        }
        if (a.bools.Length >= 1)
        {
            hash.Add("loop", a.bools[0]);
        }
        else
        {
            Debug.LogWarning("Animator: PlayAudio missing 'loop'.");
            return(false);
        }
        AMTween.PlayAudio((AudioSource)getCMP(a.go, "AudioSource"), hash);
        return(true);
    }
 public override void execute(int frameRate, float delay)
 {
     if (!audioSource || !audioClip)
     {
         return;
     }
     AMTween.PlayAudio(audioSource, AMTween.Hash("delay", getWaitTime(frameRate, delay), "audioclip", audioClip, "loop", loop));
 }
Esempio n. 3
0
 public override void execute(int frameRate, float delay)
 {
     if (!audioSource || !audioClip)
     {
         CoroutineBehaviour.StartCoroutineDelay(audioSource.gameObject, _StopClip, getWaitTime(frameRate, delay));
     }
     else
     {
         AMTween.PlayAudio(audioSource, AMTween.Hash("delay", getWaitTime(frameRate, delay), "audioclip", audioClip, "loop", loop));
     }
 }