PlayableBehaviourInteractiveSelection.cs 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  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 PlayableBehaviourInteractiveSelection : PlayableBehaviour
  8. {
  9. public Text btnText;
  10. public string textStr;
  11. public int nextInteractiveSelectionId;
  12. public void Init(Text btnText, string textStr, int nextInteractiveSelectionId)
  13. {
  14. this.btnText = btnText;
  15. this.textStr = textStr;
  16. this.nextInteractiveSelectionId = nextInteractiveSelectionId;
  17. }
  18. // Called when the owning graph starts playing
  19. public override void OnGraphStart(Playable playable)
  20. {
  21. }
  22. // Called when the owning graph stops playing
  23. public override void OnGraphStop(Playable playable)
  24. {
  25. }
  26. // Called when the state of the playable is set to Play
  27. public override void OnBehaviourPlay(Playable playable, FrameData info)
  28. {
  29. btnText.text = textStr;
  30. }
  31. // Called when the state of the playable is set to Paused
  32. public override void OnBehaviourPause(Playable playable, FrameData info)
  33. {
  34. }
  35. // Called each frame while the state is set to Play
  36. public override void PrepareFrame(Playable playable, FrameData info)
  37. {
  38. }
  39. }