summaryrefslogtreecommitdiff
path: root/Library/PackageCache/com.unity.timeline@1.2.13/Runtime/Playables/BasicScriptPlayable.cs
blob: 0157958df38b8bd585a468197db57c8e308db29f (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
using System;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Playables;

namespace UnityEngine.Timeline
{
    /// <summary>
    /// This class is deprecated. It is recommended to use Playable Asset and Playable Behaviour derived classes instead.
    /// </summary>
    [Serializable]
    [Obsolete("For best performance use PlayableAsset and PlayableBehaviour.")]
    public class BasicPlayableBehaviour : ScriptableObject, IPlayableAsset, IPlayableBehaviour
    {
        public BasicPlayableBehaviour() {}

        /// <summary>
        /// The playback duration in seconds of the instantiated Playable.
        /// </summary>
        public virtual double duration { get { return PlayableBinding.DefaultDuration; } }

        /// <summary>
        ///A description of the outputs of the instantiated Playable.
        /// </summary>
        public virtual IEnumerable<PlayableBinding> outputs { get { return PlayableBinding.None; } }

        /// <summary>
        ///   <para>This function is called when the PlayableGraph that owns this PlayableBehaviour starts.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        public virtual void OnGraphStart(Playable playable) {}

        /// <summary>
        ///   <para>This function is called when the PlayableGraph that owns this PlayableBehaviour stops.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        public virtual void OnGraphStop(Playable playable)  {}

        /// <summary>
        ///   <para>This function is called when the Playable that owns the PlayableBehaviour is created.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        public virtual void OnPlayableCreate(Playable playable) {}

        /// <summary>
        ///   <para>This function is called when the Playable that owns the PlayableBehaviour is destroyed.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        public virtual void OnPlayableDestroy(Playable playable) {}

        /// <summary>
        ///   <para>This function is called when the Playable play state is changed to Playables.PlayState.Playing.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
        public virtual void OnBehaviourPlay(Playable playable, FrameData info) {}

        /// <summary>
        ///   <para>This function is called when the Playable play state is changed to Playables.PlayState.Paused.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
        public virtual void OnBehaviourPause(Playable playable, FrameData info) {}

        /// <summary>
        ///   <para>This function is called during the PrepareFrame phase of the PlayableGraph.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
        public virtual void PrepareFrame(Playable playable, FrameData info) {}

        /// <summary>
        ///   <para>This function is called during the ProcessFrame phase of the PlayableGraph.</para>
        /// </summary>
        /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
        /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
        /// <param name="playerData">The user data of the ScriptPlayableOutput that initiated the process pass.</param>
        public virtual void ProcessFrame(Playable playable, FrameData info, object playerData) {}

        /// <summary>
        /// Implement this method to have your asset inject playables into the given graph.
        /// </summary>
        /// <param name="graph">The graph to inject playables into.</param>
        /// <param name="owner">The game object which initiated the build.</param>
        /// <returns>The playable injected into the graph, or the root playable if multiple playables are injected.</returns>
        public virtual Playable CreatePlayable(PlayableGraph graph, GameObject owner)
        {
            return ScriptPlayable<BasicPlayableBehaviour>.Create(graph, this);
        }
    }
}