ScriptPlayableTrackAnimation.cs 1.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4. using UnityEngine.Playables;
  5. using UnityEngine.UI;
  6. // A behaviour that is attached to a playable
  7. public class ScriptPlayableTrackAnimation : PlayableBehaviour
  8. {
  9. public StoryMgr mgr;
  10. public int masterId;
  11. public StoryLocation location = StoryLocation.Left;
  12. public float startTime;
  13. public float endTime;
  14. public string animationName;
  15. bool isPlayed = false;
  16. public void Init(int masterId, StoryLocation location, string animationName, StoryMgr mgr)
  17. {
  18. this.mgr = mgr;
  19. this.masterId = masterId;
  20. this.location = location;
  21. this.animationName = animationName;
  22. }
  23. // Called when the owning graph starts playing
  24. public override void OnGraphStart(Playable playable)
  25. {
  26. }
  27. // Called when the owning graph stops playing
  28. public override void OnGraphStop(Playable playable)
  29. {
  30. //Debug.Log("OnGraphStop");
  31. }
  32. // Called when the state of the playable is set to Play
  33. public override void OnBehaviourPlay(Playable playable, FrameData info)
  34. {
  35. isPlayed = true;
  36. if (mgr)
  37. {
  38. }
  39. else
  40. {
  41. }
  42. }
  43. public override void OnBehaviourPause(Playable playable, FrameData info)
  44. {
  45. //Debug.Log("pause");
  46. if (isPlayed)
  47. {
  48. }
  49. }
  50. }