private void ProcessCurrentClip(Playable playable, object playerData, DialogueBehaviour input, ClipData clipData)
        {
            double currentTime = playable.GetTime();

            if (currentTime > 0f)
            {
                if (clipData.state == ClipState.Pending)
                {
                    clipData.state = ClipState.Started;
                    (playerData as DialogueBinder)?.SetDialog(input.dialogueID);
                }

                if (clipData.state == ClipState.Started)
                {
                    if (currentTime >= m_clipsData[m_currentClipIndex].Range.End - k_StopThreshold)
                    {
                        clipData.state = ClipState.Ended;
                    }
                }

                if (clipData.state == ClipState.Ended)
                {
                    if (NextClipIndexInBounds(m_currentClipIndex + 1))
                    {
                        m_currentClipIndex++;
                        playable.SetTime(m_clipsData[m_currentClipIndex].Range.Start);
                        if (input.stopGraphOnClipEnd)
                        {
                            playable.GetGraph().Stop();
                        }
                    }
                }
            }
        }
        public override void ProcessFrame(Playable playable, FrameData info, object playerData)
        {
            CalculateCurrentClip(playable);

            ClipData data = m_clipsData[m_currentClipIndex];
            ScriptPlayable <DialogueBehaviour> playableInput = data.Input;
            DialogueBehaviour input = playableInput.GetBehaviour();

            ProcessCurrentClip(playable, playerData, input, data);
        }