Без опису
Ви не можете вибрати більше 25 тем Теми мають розпочинатися з літери або цифри, можуть містити дефіси (-) і не повинні перевищувати 35 символів.

BasicScriptPlayable.cs 4.7KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. using System;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. namespace UnityEngine.Timeline
  6. {
  7. /// <summary>
  8. /// This class is deprecated. It is recommended to use Playable Asset and Playable Behaviour derived classes instead.
  9. /// </summary>
  10. [Serializable]
  11. [Obsolete("For best performance use PlayableAsset and PlayableBehaviour.")]
  12. public class BasicPlayableBehaviour : ScriptableObject, IPlayableAsset, IPlayableBehaviour
  13. {
  14. /// <summary>
  15. /// The playback duration in seconds of the instantiated Playable.
  16. /// </summary>
  17. public virtual double duration { get { return PlayableBinding.DefaultDuration; } }
  18. /// <summary>
  19. ///A description of the outputs of the instantiated Playable.
  20. /// </summary>
  21. public virtual IEnumerable<PlayableBinding> outputs { get { return PlayableBinding.None; } }
  22. /// <summary>
  23. /// <para>This function is called when the PlayableGraph that owns this PlayableBehaviour starts.</para>
  24. /// </summary>
  25. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  26. public virtual void OnGraphStart(Playable playable) { }
  27. /// <summary>
  28. /// <para>This function is called when the PlayableGraph that owns this PlayableBehaviour stops.</para>
  29. /// </summary>
  30. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  31. public virtual void OnGraphStop(Playable playable) { }
  32. /// <summary>
  33. /// <para>This function is called when the Playable that owns the PlayableBehaviour is created.</para>
  34. /// </summary>
  35. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  36. public virtual void OnPlayableCreate(Playable playable) { }
  37. /// <summary>
  38. /// <para>This function is called when the Playable that owns the PlayableBehaviour is destroyed.</para>
  39. /// </summary>
  40. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  41. public virtual void OnPlayableDestroy(Playable playable) { }
  42. /// <summary>
  43. /// <para>This function is called when the Playable play state is changed to Playables.PlayState.Playing.</para>
  44. /// </summary>
  45. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  46. /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
  47. public virtual void OnBehaviourPlay(Playable playable, FrameData info) { }
  48. /// <summary>
  49. /// <para>This function is called when the Playable play state is changed to Playables.PlayState.Paused.</para>
  50. /// </summary>
  51. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  52. /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
  53. public virtual void OnBehaviourPause(Playable playable, FrameData info) { }
  54. /// <summary>
  55. /// <para>This function is called during the PrepareFrame phase of the PlayableGraph.</para>
  56. /// </summary>
  57. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  58. /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
  59. public virtual void PrepareFrame(Playable playable, FrameData info) { }
  60. /// <summary>
  61. /// <para>This function is called during the ProcessFrame phase of the PlayableGraph.</para>
  62. /// </summary>
  63. /// <param name="playable">The Playable that owns the current PlayableBehaviour.</param>
  64. /// <param name="info">A FrameData structure that contains information about the current frame context.</param>
  65. /// <param name="playerData">The user data of the ScriptPlayableOutput that initiated the process pass.</param>
  66. public virtual void ProcessFrame(Playable playable, FrameData info, object playerData) { }
  67. /// <summary>
  68. /// Implement this method to have your asset inject playables into the given graph.
  69. /// </summary>
  70. /// <param name="graph">The graph to inject playables into.</param>
  71. /// <param name="owner">The game object which initiated the build.</param>
  72. /// <returns>The playable injected into the graph, or the root playable if multiple playables are injected.</returns>
  73. public virtual Playable CreatePlayable(PlayableGraph graph, GameObject owner)
  74. {
  75. return ScriptPlayable<BasicPlayableBehaviour>.Create(graph, this);
  76. }
  77. }
  78. }