fr.jeanf.eventsystem 0.1.119 → 0.1.121

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.
@@ -30,7 +30,7 @@ namespace jeanf.EventSystem
30
30
 
31
31
  [SerializeField] private TimelineTriggerEventChannelSO _channel;
32
32
  [SerializeField] private PlayableDirector _playableDirectorToControl;
33
- private PlayState _lastPlayableState;
33
+ private PlayState _lastKnownPlayableState;
34
34
 
35
35
  [Tooltip("Use this if you want to override the timeline assigned to the playable director.")]
36
36
  [SerializeField] private bool assignTimelineToPlayableDirector = true;
@@ -62,35 +62,38 @@ namespace jeanf.EventSystem
62
62
  OnEventRaised?.Invoke(timeline, value);
63
63
  if (value)
64
64
  {
65
- isStop = false;
65
+ _playableDirectorToControl.Stop();
66
+ _playableDirectorToControl.RebuildGraph();
66
67
  _playableDirectorToControl.Play();
68
+ isStop = false;
69
+ _lastKnownPlayableState = _playableDirectorToControl.state;
67
70
  if(isDebug) Debug.Log($"received timeline: playing {timeline.name}, isStop: {isStop}, _playableDirectorToControl.state {_playableDirectorToControl.state}");
68
71
  }
69
72
  else
70
73
  {
71
74
  isStop = true;
72
75
  _playableDirectorToControl.Stop();
76
+ _lastKnownPlayableState = _playableDirectorToControl.state;
73
77
  if(isDebug) Debug.Log($"received timeline: stoping {timeline.name}, isStop: {isStop}, _playableDirectorToControl.state {_playableDirectorToControl.state}");
74
78
  }
75
79
 
76
- _lastPlayableState = _playableDirectorToControl.state;
77
-
78
80
  if(isDebug) Debug.Log($" timeline-bool event raised: <{timeline},{value}>, timelineState: {_playableDirectorToControl.state}");
79
81
  }
80
82
 
81
83
  private void Pause(bool state) // true = pause ... false = unpause
82
84
  {
85
+ if(isDebug) Debug.Log($"isStop = {isStop}, state {state}, _lastPlayableState {_lastKnownPlayableState}");
83
86
  if(isStop) return;
84
87
 
85
- switch (_lastPlayableState)
88
+ switch (_lastKnownPlayableState)
86
89
  {
87
90
  case PlayState.Playing:
88
91
  if (state)
89
92
  {
90
93
  _playableDirectorToControl.Pause();
91
- _lastPlayableState = _playableDirectorToControl.state;
94
+ _lastKnownPlayableState = _playableDirectorToControl.state;
92
95
 
93
- if(isDebug) Debug.Log($"_lastPlayableState = PlayState.isPlaying : pausing the timeline");
96
+ if(isDebug) Debug.Log($"_lastPlayableState = {_lastKnownPlayableState} : pausing the timeline");
94
97
  }
95
98
  break;
96
99
 
@@ -99,8 +102,8 @@ namespace jeanf.EventSystem
99
102
  {
100
103
  isStop = false;
101
104
  _playableDirectorToControl.Play();
102
- _lastPlayableState = _playableDirectorToControl.state;
103
- if(isDebug) Debug.Log($"_lastPlayableState = PlayState.Paused : continuing playing the timeline");
105
+ _lastKnownPlayableState = _playableDirectorToControl.state;
106
+ if(isDebug) Debug.Log($"_lastPlayableState = {_lastKnownPlayableState} : continuing playing the timeline");
104
107
  }
105
108
  break;
106
109
  case PlayState.Delayed:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fr.jeanf.eventsystem",
3
- "version": "0.1.119",
3
+ "version": "0.1.121",
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",