ScriptPlayableTrackAudio.cs 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556
  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 ScriptPlayableTrackAudio : PlayableBehaviour
  8. {
  9. public StoryMgr mgr;
  10. public string audioName;
  11. public float startTime;
  12. public float endTime;
  13. bool isPlayed = false;
  14. public void Init(string audioName, StoryMgr mgr)
  15. {
  16. this.mgr = mgr;
  17. this.audioName = audioName;
  18. }
  19. // Called when the owning graph starts playing
  20. public override void OnGraphStart(Playable playable)
  21. {
  22. }
  23. // Called when the owning graph stops playing
  24. public override void OnGraphStop(Playable playable)
  25. {
  26. //Debug.Log("OnGraphStop");
  27. }
  28. // Called when the state of the playable is set to Play
  29. public override void OnBehaviourPlay(Playable playable, FrameData info)
  30. {
  31. isPlayed = true;
  32. if (mgr)
  33. {
  34. }
  35. else
  36. {
  37. }
  38. }
  39. public override void OnBehaviourPause(Playable playable, FrameData info)
  40. {
  41. //Debug.Log("pause");
  42. if (isPlayed)
  43. {
  44. }
  45. }
  46. }