Пример #1
0
    IEnumerator Start()
    {
        //  Preemptively load clips.
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if ((renderer == null) || (renderer.clipNames == null))
        {
            yield break;
        }

        //yield return StartCoroutine(renderer.WaitForDownloads());

        foreach (string clipName in renderer.clipNames)
        {
            renderer.LoadClipName(clipName);
        }

        //  Wait for audio if necessary.
        HarmonyAudio audio = GetComponent <HarmonyAudio>();

        if (audio != null)
        {
            yield return(StartCoroutine(audio.WaitForDownloads()));
        }
    }
Пример #2
0
    private void PlayStaticFramePriv(float staticFrame, string clipName, float duration, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null)
        {
            //  Load clip at index if not already loaded.
            renderer.LoadClipName(clipName);
        }

        if (duration < 0.0f)
        {
            AnimationClip clip = new AnimationClip(gameObject, 0.0f, clipName, staticFrame, 1.0f /*don't care*/, -1, false /*forward*/, callbacks);
            PlayPriv(clip);
        }
        else
        {
            AnimationClip clip = new AnimationClip(gameObject, 0.0f, clipName, staticFrame, duration, 1, false /*forward*/, callbacks);
            PlayPriv(clip);
        }
    }
Пример #3
0
    private void PlayAnimationPriv(float frameRate, string clipName, float startFrame, float duration, int nTimes, bool reverse, CallbackEvents callbacks)
    {
        HarmonyRenderer renderer = GetComponent <HarmonyRenderer>();

        if (renderer != null)
        {
            //  Load clip at index if not already loaded.
            renderer.LoadClipName(clipName);

            //  Negative duration, replace with clip full duration.
            if (duration < 0.0f)
            {
                float nFrames = renderer.GetClipFrameCount(clipName);
                duration = (frameRate > 0.0f) ? ((nFrames + 1.0f - startFrame) / frameRate) : 0.0f;
            }
        }

        if (duration > 0.0f)
        {
            AnimationClip clip = new AnimationClip(gameObject, frameRate, clipName, startFrame, duration, nTimes, reverse, callbacks);
            PlayPriv(clip);
        }
    }