FCommentEvent.cs 982 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. using UnityEngine;
  2. namespace Flux
  3. {
  4. //[FEventAttribute("Misc/Comment", typeof(FCommentTrack))]
  5. public class FCommentEvent : FEvent {
  6. [SerializeField]
  7. private string _comment = "!Comment!";
  8. public override string Text {
  9. get { return _comment; }
  10. set { _comment = value; }
  11. }
  12. [SerializeField]
  13. private Color _color = new Color( 0.15f, 0.6f, 0.95f, 0.8f );
  14. public Color Color { get { return _color; } set { _color = value; } }
  15. protected override void OnTrigger( float timeSinceTrigger )
  16. {
  17. FCommentTrack commentTrack = (FCommentTrack)Track;
  18. if (commentTrack.Label != null)
  19. commentTrack.Label.text = Text;
  20. }
  21. protected override void OnFinish ()
  22. {
  23. base.OnFinish();
  24. ClearText();
  25. }
  26. protected override void OnStop ()
  27. {
  28. base.OnStop();
  29. ClearText();
  30. }
  31. private void ClearText()
  32. {
  33. FCommentTrack commentTrack = (FCommentTrack)Track;
  34. if (commentTrack.Label != null)
  35. commentTrack.Label.text = string.Empty;
  36. }
  37. }
  38. }