// NOTE: This function is called at runtime and edit time. Keep that in mind when setting the values of properties. public override void ProcessFrame(Playable playable, FrameData info, object playerData) { GameObject trackBinding = playerData as GameObject; Transform speaker = (trackBinding != null) ? trackBinding.transform : null; int inputCount = playable.GetInputCount(); for (int i = 0; i < inputCount; i++) { float inputWeight = playable.GetInputWeight(i); if (inputWeight > 0.001f && !played.Contains(i)) { played.Add(i); ScriptPlayable <PlaySequenceBehaviour> inputPlayable = (ScriptPlayable <PlaySequenceBehaviour>)playable.GetInput(i); PlaySequenceBehaviour input = inputPlayable.GetBehaviour(); var sequence = input.sequence; if (Application.isPlaying) { DialogueManager.PlaySequence(sequence, speaker, input.listener); } else { PreviewUI.ShowMessage(sequence, 3, -1); } } else if (inputWeight <= 0.001f && played.Contains(i)) { played.Remove(i); } } }
public override Playable CreatePlayable(PlayableGraph graph, GameObject owner) { var playable = ScriptPlayable <PlaySequenceBehaviour> .Create(graph, template); PlaySequenceBehaviour clone = playable.GetBehaviour(); clone.listener = listener.Resolve(graph.GetResolver()); return(playable); }