fr.jeanf.eventsystem 0.1.113 → 0.1.115

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -36,16 +36,20 @@ namespace jeanf.EventSystem
36
36
  [Tooltip("If you want to do more than just turning triggering play/stop on the timeline")]
37
37
  public TimelineBoolEvent OnEventRaised;
38
38
 
39
+ [SerializeField] private BoolEventChannelSO generalPauseEvent;
40
+
39
41
  private void OnEnable()
40
42
  {
41
43
  if (_channel != null)
42
44
  _channel.OnEventRaised += Respond;
45
+ if (generalPauseEvent) generalPauseEvent.OnEventRaised += Pause;
43
46
  }
44
47
 
45
48
  private void OnDisable()
46
49
  {
47
50
  if (_channel != null)
48
51
  _channel.OnEventRaised -= Respond;
52
+ if (generalPauseEvent) generalPauseEvent.OnEventRaised -= Pause;
49
53
  }
50
54
 
51
55
  private void Respond(PlayableAsset timeline, bool value)
@@ -63,5 +67,22 @@ namespace jeanf.EventSystem
63
67
  }
64
68
  if(isDebug) Debug.Log($" timeline-bool event raised: <{timeline},{value}>");
65
69
  }
70
+
71
+ private PlayState _lastPlayableState;
72
+ private void Pause(bool state)
73
+ {
74
+ switch (state)
75
+ {
76
+ case true when _lastPlayableState == PlayState.Playing:
77
+ _playableDirectorToControl.Pause();
78
+ break;
79
+
80
+ case false when _lastPlayableState == PlayState.Paused:
81
+ _playableDirectorToControl.Play();
82
+ break;
83
+ }
84
+
85
+ _lastPlayableState = _playableDirectorToControl.state;
86
+ }
66
87
  }
67
88
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.eventsystem",
3
- "version": "0.1.113",
3
+ "version": "0.1.115",
4
4
  "displayName": "Event System",
5
5
  "description": "This package contains a basic Event System based on Scriptable Objects as communication medium",
6
6
  "unity": "2021.3",