fr.jeanf.eventsystem 0.1.86 → 0.1.88

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.
Files changed (40) hide show
  1. package/Runtime/BaseClasses/DescriptionBaseSO.cs +8 -1
  2. package/Runtime/Editor/SendActionRebindEventOnClick.cs +43 -0
  3. package/Runtime/Editor/SendActionRebindEventOnClick.cs.meta +11 -0
  4. package/Runtime/Editor/SendInputActionIntEventOnClick.cs +41 -0
  5. package/Runtime/Editor/SendInputActionIntEventOnClick.cs.meta +11 -0
  6. package/Runtime/Editor/SendInputEventOnClick.cs +40 -0
  7. package/Runtime/Editor/SendInputEventOnClick.cs.meta +11 -0
  8. package/Runtime/Editor/SendTimelineTriggerEventOnClick.cs +38 -0
  9. package/Runtime/Editor/SendTimelineTriggerEventOnClick.cs.meta +11 -0
  10. package/Runtime/Listeners/InputActionEventListener.cs +44 -0
  11. package/Runtime/Listeners/InputActionEventListener.cs.meta +11 -0
  12. package/Runtime/Listeners/InputActionIntEventListener.cs +49 -0
  13. package/Runtime/Listeners/InputActionIntEventListener.cs.meta +11 -0
  14. package/Runtime/Listeners/TimelineTriggerEventListener.cs +66 -0
  15. package/Runtime/Listeners/TimelineTriggerEventListener.cs.meta +11 -0
  16. package/Runtime/ScriptableObjects/ActionRebindEventChannelSO.cs +37 -0
  17. package/Runtime/ScriptableObjects/ActionRebindEventChannelSO.cs.meta +11 -0
  18. package/Runtime/ScriptableObjects/Advanced/TimelineTriggerEventChannelSO.cs +18 -0
  19. package/Runtime/ScriptableObjects/Advanced/TimelineTriggerEventChannelSO.cs.meta +11 -0
  20. package/Runtime/ScriptableObjects/InputActionEventChannelSO.cs +19 -0
  21. package/Runtime/ScriptableObjects/InputActionEventChannelSO.cs.meta +11 -0
  22. package/Runtime/ScriptableObjects/InputActionIntEventChannelSO.cs +19 -0
  23. package/Runtime/ScriptableObjects/InputActionIntEventChannelSO.cs.meta +11 -0
  24. package/Runtime/ScriptableObjects/QuaternionEventChannelSO.cs +21 -0
  25. package/Runtime/ScriptableObjects/QuaternionEventChannelSO.cs.meta +11 -0
  26. package/Runtime/ScriptableObjects/Vector2EventChannelSO.cs +21 -0
  27. package/Runtime/ScriptableObjects/Vector2EventChannelSO.cs.meta +11 -0
  28. package/Runtime/ScriptableObjects/Vector3EventChannelSO.cs +21 -0
  29. package/Runtime/ScriptableObjects/Vector3EventChannelSO.cs.meta +11 -0
  30. package/Runtime/SenderInterfaces/IInputActionEventSender.cs +11 -0
  31. package/Runtime/SenderInterfaces/IInputActionEventSender.cs.meta +11 -0
  32. package/Runtime/SenderInterfaces/IInputActionIntEventSender.cs +23 -0
  33. package/Runtime/SenderInterfaces/IInputActionIntEventSender.cs.meta +11 -0
  34. package/Runtime/SenderInterfaces/TimelineBoolEventSender.cs +23 -0
  35. package/Runtime/SenderInterfaces/TimelineBoolEventSender.cs.meta +11 -0
  36. package/Runtime/SenderInterfaces/TransformEventSender.cs +2 -2
  37. package/Runtime/jeanf.eventSystem.asmdef +2 -1
  38. package/TimelineTriggerChannelSO.asset +16 -0
  39. package/TimelineTriggerChannelSO.asset.meta +8 -0
  40. package/package.json +21 -21
@@ -1,4 +1,4 @@
1
- using System;
1
+ using System;
2
2
  using UnityEngine;
3
3
 
4
4
  namespace jeanf.EventSystem
@@ -9,5 +9,12 @@ namespace jeanf.EventSystem
9
9
  public abstract class DescriptionBaseSO : SerializableScriptableObject
10
10
  {
11
11
  [TextArea] public string description;
12
+
13
+
14
+ public void DelegateMethod(Action action)
15
+ {
16
+ action?.Invoke();
17
+ }
18
+
12
19
  }
13
20
  }
@@ -0,0 +1,43 @@
1
+
2
+ #if UNITY_EDITOR
3
+
4
+ using jeanf.EventSystem;
5
+ using UnityEditor;
6
+ using UnityEngine;
7
+ using UnityEngine.InputSystem;
8
+ namespace jeanf.EventSystem
9
+ {
10
+ public class SendActionRebindEventOnClick : MonoBehaviour
11
+ {
12
+
13
+ [Header("Broadcasting on:")]
14
+ [SerializeField]
15
+ private ActionRebindEventChannelSO TestChannel;
16
+
17
+ [Space(20)]
18
+ [SerializeField] private InputActionReference actionToSend;
19
+ [SerializeField] private string bindingPath;
20
+ public void CallFunction()
21
+ {
22
+ TestChannel.RaiseEvent(actionToSend, bindingPath);
23
+ }
24
+ }
25
+
26
+ [CustomEditor(typeof(SendActionRebindEventOnClick))]
27
+ public class ActionRebindEventOnClickEditor : Editor
28
+ {
29
+ override public void OnInspectorGUI()
30
+ {
31
+ DrawDefaultInspector();
32
+ var eventToSend = (SendActionRebindEventOnClick)target;
33
+ if (GUILayout.Button("Send ActionInt", GUILayout.Height(30)))
34
+ {
35
+ eventToSend.CallFunction(); // how do i call this?
36
+ }
37
+ GUILayout.Space(10);
38
+ }
39
+ }
40
+ }
41
+
42
+ #endif
43
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 206aafdf8b3f00b4da9a0870a6734f32
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,41 @@
1
+ #if UNITY_EDITOR
2
+
3
+ using jeanf.EventSystem;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+ using UnityEngine.InputSystem;
7
+ namespace jeanf.EventSystem
8
+ {
9
+ public class SendInputActionIntEventOnClick : MonoBehaviour
10
+ {
11
+
12
+ [Header("Broadcasting on:")]
13
+ [SerializeField]
14
+ private InputActionIntEventChannelSO TestChannel;
15
+
16
+ [Space(20)]
17
+ [SerializeField] private InputActionReference actionToSend;
18
+ [SerializeField] private int intToSend;
19
+ public void CallFunction()
20
+ {
21
+ TestChannel.RaiseEvent(actionToSend, intToSend);
22
+ }
23
+ }
24
+
25
+ [CustomEditor(typeof(SendInputActionIntEventOnClick))]
26
+ public class InputActionIntEventOnClickEditor : Editor
27
+ {
28
+ override public void OnInspectorGUI()
29
+ {
30
+ DrawDefaultInspector();
31
+ var eventToSend = (SendInputActionIntEventOnClick)target;
32
+ if (GUILayout.Button("Send ActionInt", GUILayout.Height(30)))
33
+ {
34
+ eventToSend.CallFunction(); // how do i call this?
35
+ }
36
+ GUILayout.Space(10);
37
+ }
38
+ }
39
+ }
40
+
41
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 423cf5c6ae6ce534abc4a42e4190d689
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,40 @@
1
+ #if UNITY_EDITOR
2
+
3
+ using jeanf.EventSystem;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+ using UnityEngine.InputSystem;
7
+ namespace jeanf.EventSystem
8
+ {
9
+ public class SendInputEventOnClick : MonoBehaviour
10
+ {
11
+
12
+ [Header("Broadcasting on:")]
13
+ [SerializeField]
14
+ private InputActionEventChannelSO TestChannel;
15
+
16
+ [Space(20)]
17
+ [SerializeField] private InputAction messageToSend;
18
+ public void CallFunction()
19
+ {
20
+ TestChannel.RaiseEvent(messageToSend);
21
+ }
22
+ }
23
+
24
+ [CustomEditor(typeof(SendInputEventOnClick))]
25
+ public class InputActionEventOnClickEditor : Editor
26
+ {
27
+ override public void OnInspectorGUI()
28
+ {
29
+ DrawDefaultInspector();
30
+ var eventToSend = (SendInputEventOnClick)target;
31
+ if (GUILayout.Button("Send Action", GUILayout.Height(30)))
32
+ {
33
+ eventToSend.CallFunction(); // how do i call this?
34
+ }
35
+ GUILayout.Space(10);
36
+ }
37
+ }
38
+ }
39
+
40
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: af9d73da0ff15d545b05549bff537b1c
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,38 @@
1
+ #if UNITY_EDITOR
2
+
3
+ using jeanf.EventSystem;
4
+ using UnityEditor;
5
+ using UnityEngine;
6
+ using UnityEngine.Playables;
7
+
8
+ namespace jeanf.EventSystem
9
+ {
10
+ public class SendTimelineTriggerEventOnClick : MonoBehaviour
11
+ {
12
+
13
+ [Header("Broadcasting on:")] [SerializeField]
14
+ private TimelineTriggerEventChannelSO TestChannel;
15
+
16
+ [Space(20)]
17
+ [SerializeField] private PlayableAsset timeline;
18
+ [SerializeField] private bool state = true;
19
+ public void CallFunction()
20
+ {
21
+ TestChannel.RaiseEvent(timeline, state);
22
+ }
23
+ }
24
+
25
+ [CustomEditor(typeof(SendTimelineTriggerEventOnClick))]
26
+ public class SendTimelineTriggerEventOnClickEditor : Editor {
27
+ override public void OnInspectorGUI () {
28
+ DrawDefaultInspector();
29
+ var eventToSend = (SendTimelineTriggerEventOnClick)target;
30
+ if(GUILayout.Button("Send timeline trigger", GUILayout.Height(30))) {
31
+ eventToSend.CallFunction(); // how do i call this?
32
+ }
33
+ GUILayout.Space(10);
34
+ }
35
+ }
36
+ }
37
+
38
+ #endif
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b02b83e3a02288749bad8c83edb01c6b
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,44 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using UnityEngine.InputSystem;
5
+ using UnityEngine.Events;
6
+
7
+ namespace jeanf.EventSystem
8
+ {
9
+ [System.Serializable]
10
+ public class InputActionEvent : UnityEvent<InputAction>
11
+ {
12
+
13
+ }
14
+ public class InputActionEventListener : MonoBehaviour
15
+ {
16
+ public InputActionEventChannelSO _channel = default;
17
+
18
+ public InputActionEvent OnInputActionEventRaised;
19
+
20
+ private void OnEnable()
21
+ {
22
+ if (_channel != null)
23
+ _channel.OnEventRaised += Respond;
24
+ }
25
+
26
+ private void OnDisable()
27
+ {
28
+ if (_channel != null)
29
+ _channel.OnEventRaised -= Respond;
30
+ }
31
+
32
+ private void Respond(InputAction value)
33
+ {
34
+ OnInputActionEventRaised?.Invoke(value);
35
+ }
36
+
37
+ public InputActionEventListener(InputActionEventChannelSO _channel, InputActionEvent OnInputActionEventRaised)
38
+ {
39
+ this._channel = _channel;
40
+ this.OnInputActionEventRaised = OnInputActionEventRaised;
41
+ }
42
+ }
43
+ }
44
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 4784c6f5e9239224a9de18a73e44c1e7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,49 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+ using UnityEngine.InputSystem;
4
+ /// <summary>
5
+ /// To use a generic UnityEvent type you must override the generic type.
6
+ /// </summary>
7
+ namespace jeanf.EventSystem
8
+ {
9
+ [System.Serializable]
10
+ public class InputActionIntEvent : UnityEvent<InputAction, int>
11
+ {
12
+
13
+ }
14
+
15
+ /// <summary>
16
+ /// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
17
+ /// </summary>
18
+ public class InputActionIntEventListener : MonoBehaviour, IDebugBehaviour
19
+ {
20
+ public bool isDebug
21
+ {
22
+ get => _isDebug;
23
+ set => _isDebug = value;
24
+ }
25
+ [SerializeField] private bool _isDebug = false;
26
+
27
+ [SerializeField] private InputActionIntEventChannelSO _channel = default;
28
+
29
+ public InputActionIntEvent OnEventRaised;
30
+
31
+ private void OnEnable()
32
+ {
33
+ if (_channel != null)
34
+ _channel.OnEventRaised += Respond;
35
+ }
36
+
37
+ private void OnDisable()
38
+ {
39
+ if (_channel != null)
40
+ _channel.OnEventRaised -= Respond;
41
+ }
42
+
43
+ private void Respond(InputAction action, int value)
44
+ {
45
+ OnEventRaised?.Invoke(action, value);
46
+ if (isDebug) Debug.Log($" int-bool event raised: <{action},{value}>");
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 0d333e10a465e6342bd7d9652635fa67
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,66 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+ using UnityEngine.Playables;
4
+ using UnityEngine.Serialization;
5
+
6
+ /// <summary>
7
+ /// To use a generic UnityEvent type you must override the generic type.
8
+ /// </summary>
9
+ namespace jeanf.EventSystem
10
+ {
11
+ [System.Serializable]
12
+ public class TimelineBoolEvent : UnityEvent<PlayableAsset, bool>
13
+ {
14
+
15
+ }
16
+
17
+ /// <summary>
18
+ /// A flexible handler for int events in the form of a MonoBehaviour. Responses can be connected directly from the Unity Inspector.
19
+ /// </summary>
20
+ public class TimelineTriggerEventListener : MonoBehaviour, IDebugBehaviour
21
+ {
22
+ public bool isDebug
23
+ {
24
+ get => _isDebug;
25
+ set => _isDebug = value;
26
+ }
27
+ [SerializeField] private bool _isDebug = false;
28
+
29
+ [SerializeField] private TimelineTriggerEventChannelSO _channel = default;
30
+ [SerializeField] private PlayableDirector _playableDirectorToControl;
31
+ [Tooltip("Use this if you want to override the timeline assigned to the playable director.")]
32
+ [SerializeField] private bool assignTimelineToPlayableDirector = true;
33
+ [Space(10)]
34
+
35
+ [Tooltip("If you want to do more than just turning triggering play/stop on the timeline")]
36
+ public TimelineBoolEvent OnEventRaised;
37
+
38
+ private void OnEnable()
39
+ {
40
+ if (_channel != null)
41
+ _channel.OnEventRaised += Respond;
42
+ }
43
+
44
+ private void OnDisable()
45
+ {
46
+ if (_channel != null)
47
+ _channel.OnEventRaised -= Respond;
48
+ }
49
+
50
+ private void Respond(PlayableAsset timeline, bool value)
51
+ {
52
+ if (assignTimelineToPlayableDirector) _playableDirectorToControl.playableAsset = timeline;
53
+ if(timeline != _playableDirectorToControl.playableAsset) return;
54
+ OnEventRaised?.Invoke(timeline, value);
55
+ if (value)
56
+ {
57
+ _playableDirectorToControl.Play();
58
+ }
59
+ else
60
+ {
61
+ _playableDirectorToControl.Stop();
62
+ }
63
+ if(isDebug) Debug.Log($" timeline-bool event raised: <{timeline},{value}>");
64
+ }
65
+ }
66
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: a9781a564f862bf4d938b5a625d6820e
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,37 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+ using UnityEngine.InputSystem;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ [CreateAssetMenu(menuName = "Events/Rebind/ActionRebind Event Channel")]
8
+
9
+ public class ActionRebindEventChannelSO : DescriptionBaseSO
10
+ {
11
+ public UnityAction<InputAction, int> OnEventRaised;
12
+
13
+ public void RaiseEvent(InputAction action, string bindingPath)
14
+ {
15
+ int index = 0;
16
+ foreach (var binding in action.bindings)
17
+ {
18
+ InputBinding bindingToRebind = new InputBinding { path = bindingPath };
19
+ if (!bindingToRebind.Matches(binding))
20
+ {
21
+ continue;
22
+ }
23
+ index = action.GetBindingIndex(bindingToRebind);
24
+ }
25
+ OnEventRaised?.Invoke(action, index);
26
+ }
27
+
28
+ public void RaiseEvent(InputAction action, int index)
29
+ {
30
+
31
+ OnEventRaised?.Invoke(action, index);
32
+ }
33
+ }
34
+
35
+
36
+ }
37
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 07acdafef6947c54d8c60534270145fb
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,18 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+ using UnityEngine.Playables;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ [CreateAssetMenu(menuName = "Events/Advanced/<Timeline,Bool> Event Channel")]
8
+
9
+ public class TimelineTriggerEventChannelSO : DescriptionBaseSO
10
+ {
11
+ public UnityAction<PlayableAsset, bool> OnEventRaised;
12
+
13
+ public void RaiseEvent(PlayableAsset timeline, bool state)
14
+ {
15
+ OnEventRaised?.Invoke(timeline, state);
16
+ }
17
+ }
18
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 97d0530efe5478143ac4fcef47a977f5
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,19 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+ using UnityEngine.Events;
5
+ using UnityEngine.InputSystem;
6
+
7
+ namespace jeanf.EventSystem
8
+ {
9
+ public class InputActionEventChannelSO : DescriptionBaseSO
10
+ {
11
+ public UnityAction<InputAction> OnEventRaised;
12
+
13
+ public void RaiseEvent(InputAction value)
14
+ {
15
+ if (OnEventRaised != null)
16
+ OnEventRaised?.Invoke(value);
17
+ }
18
+ }
19
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d66806095f471984582045b2acda42fc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,19 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+ using UnityEngine.InputSystem;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ [CreateAssetMenu(menuName = "Events/Advanced/<InputAction,Int> Event Channel")]
8
+
9
+ public class InputActionIntEventChannelSO : DescriptionBaseSO
10
+ {
11
+ public UnityAction<InputAction, int> OnEventRaised;
12
+
13
+ public void RaiseEvent(InputAction action, int value)
14
+ {
15
+ OnEventRaised?.Invoke(action, value);
16
+ }
17
+ }
18
+ }
19
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 863622607d8dca2428a24fd6ce0d5221
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,21 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+
4
+ /// <summary>
5
+ /// This class is used for Events that have one int argument.
6
+ /// Example: An Achievement unlock event, where the int is the Achievement ID.
7
+ /// </summary>
8
+ namespace jeanf.EventSystem
9
+ {
10
+ [CreateAssetMenu(menuName = "Events/Quaternion Event Channel")]
11
+ public class QuaternionEventChannelSO : DescriptionBaseSO
12
+ {
13
+ public UnityAction<Quaternion> OnEventRaised;
14
+
15
+ public void RaiseEvent(Quaternion value)
16
+ {
17
+ if (OnEventRaised != null)
18
+ OnEventRaised.Invoke(value);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: ebd61391c6988a447a8948e464ea4dd3
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,21 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+
4
+ /// <summary>
5
+ /// This class is used for Events that have one int argument.
6
+ /// Example: An Achievement unlock event, where the int is the Achievement ID.
7
+ /// </summary>
8
+ namespace jeanf.EventSystem
9
+ {
10
+ [CreateAssetMenu(menuName = "Events/Vector2 Event Channel")]
11
+ public class Vector2EventChannelSO : DescriptionBaseSO
12
+ {
13
+ public UnityAction<Vector2> OnEventRaised;
14
+
15
+ public void RaiseEvent(Vector2 value)
16
+ {
17
+ if (OnEventRaised != null)
18
+ OnEventRaised.Invoke(value);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 6b3e4e5063971004284d57cdba528ff7
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,21 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Events;
3
+
4
+ /// <summary>
5
+ /// This class is used for Events that have one int argument.
6
+ /// Example: An Achievement unlock event, where the int is the Achievement ID.
7
+ /// </summary>
8
+ namespace jeanf.EventSystem
9
+ {
10
+ [CreateAssetMenu(menuName = "Events/Vector3 Event Channel")]
11
+ public class Vector3EventChannelSO : DescriptionBaseSO
12
+ {
13
+ public UnityAction<Vector3> OnEventRaised;
14
+
15
+ public void RaiseEvent(Vector3 value)
16
+ {
17
+ if (OnEventRaised != null)
18
+ OnEventRaised.Invoke(value);
19
+ }
20
+ }
21
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: 976758970f04c4e40ba04f4b269f26fc
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,11 @@
1
+ using System.Collections;
2
+ using System.Collections.Generic;
3
+ using UnityEngine;
4
+
5
+ namespace jeanf.EventSystem
6
+ {
7
+ public interface IInputActionEventSender
8
+ {
9
+ InputActionEventChannelSO inputActionMessageChannel { get; set; }
10
+ }
11
+ }
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: d283bb425c4454e42908bc4f7236d1b6
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,23 @@
1
+ using UnityEngine;
2
+
3
+ namespace jeanf.EventSystem
4
+ {
5
+ public class IInputActionIntEventSender : MonoBehaviour, IDebugBehaviour
6
+ {
7
+ public bool isDebug
8
+ {
9
+ get => _isDebug;
10
+ set => _isDebug = value;
11
+ }
12
+ [SerializeField] private bool _isDebug = false;
13
+
14
+ [field: Header("Broadcasting on:")] public IntBoolEventChannelSO boolMessageChannel;
15
+
16
+ public void SendIntBool(int nb, bool value)
17
+ {
18
+ boolMessageChannel.RaiseEvent(nb, value);
19
+ }
20
+ }
21
+ }
22
+
23
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: af6b1ccb1c342734cb59e9868abe5c17
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -0,0 +1,23 @@
1
+ using UnityEngine;
2
+ using UnityEngine.Playables;
3
+
4
+ namespace jeanf.EventSystem
5
+ {
6
+ public class TimelineBoolEventSender : MonoBehaviour, IDebugBehaviour
7
+ {
8
+ public bool isDebug
9
+ {
10
+ get => _isDebug;
11
+ set => _isDebug = value;
12
+ }
13
+ [SerializeField] private bool _isDebug = false;
14
+
15
+ [field: Header("Broadcasting on:")] public TimelineTriggerEventChannelSO timelineMessageChannel;
16
+
17
+ public void SendIntBool(PlayableAsset timeline, bool value)
18
+ {
19
+ timelineMessageChannel.RaiseEvent(timeline, value);
20
+ }
21
+ }
22
+ }
23
+
@@ -0,0 +1,11 @@
1
+ fileFormatVersion: 2
2
+ guid: b3b7fc6f450c52046852aacdf2929839
3
+ MonoImporter:
4
+ externalObjects: {}
5
+ serializedVersion: 2
6
+ defaultReferences: []
7
+ executionOrder: 0
8
+ icon: {instanceID: 0}
9
+ userData:
10
+ assetBundleName:
11
+ assetBundleVariant:
@@ -12,11 +12,11 @@ namespace jeanf.EventSystem
12
12
  }
13
13
  [SerializeField] private bool _isDebug = false;
14
14
  [SerializeField] private bool _sendTransfromOnAwake;
15
- [SerializeField] private bool _sendCustomTransform;
15
+ [SerializeField] private static bool _sendCustomTransform;
16
16
  [DrawIf("_sendCustomTransform", true, ComparisonType.Equals)]
17
17
  [SerializeField] private Transform _transform;
18
18
 
19
- [field: Header("Broadcasting on:")] public TransformEventChannelSO transformMessageChannel;
19
+ [Header("Broadcasting on:")] public TransformEventChannelSO transformMessageChannel;
20
20
 
21
21
  public void SendTransform(Transform value)
22
22
  {
@@ -2,7 +2,8 @@
2
2
  "name": "jeanf.eventsystem",
3
3
  "rootNamespace": "",
4
4
  "references": [
5
- "GUID:e8958e6939af7314a97769de4be4ce25"
5
+ "GUID:e8958e6939af7314a97769de4be4ce25",
6
+ "GUID:75469ad4d38634e559750d17036d5f7c"
6
7
  ],
7
8
  "includePlatforms": [],
8
9
  "excludePlatforms": [],
@@ -0,0 +1,16 @@
1
+ %YAML 1.1
2
+ %TAG !u! tag:unity3d.com,2011:
3
+ --- !u!114 &11400000
4
+ MonoBehaviour:
5
+ m_ObjectHideFlags: 0
6
+ m_CorrespondingSourceObject: {fileID: 0}
7
+ m_PrefabInstance: {fileID: 0}
8
+ m_PrefabAsset: {fileID: 0}
9
+ m_GameObject: {fileID: 0}
10
+ m_Enabled: 1
11
+ m_EditorHideFlags: 0
12
+ m_Script: {fileID: 11500000, guid: 97d0530efe5478143ac4fcef47a977f5, type: 3}
13
+ m_Name: TimelineTriggerChannelSO
14
+ m_EditorClassIdentifier:
15
+ _guid:
16
+ description:
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: d133dd65d19085f429e9c046abc32538
3
+ NativeFormatImporter:
4
+ externalObjects: {}
5
+ mainObjectFileID: 11400000
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json CHANGED
@@ -1,31 +1,31 @@
1
1
  {
2
- "name":"fr.jeanf.eventsystem",
3
- "version":"0.1.86",
4
- "displayName":"Event System",
5
- "description":"This package contains a basic Event System based on Scriptable Objects as communication medium",
2
+ "name": "fr.jeanf.eventsystem",
3
+ "version": "0.1.88",
4
+ "displayName": "Event System",
5
+ "description": "This package contains a basic Event System based on Scriptable Objects as communication medium",
6
6
  "unity": "2021.3",
7
7
  "keywords": [
8
8
  "jeanf",
9
9
  "event system"
10
10
  ],
11
- "author":{
12
- "name":"Jean-François Robin",
13
- "email":"robin.jeanfrancois@gmail.com",
14
- "url":"https://jeanfrancoisrobin.art"
11
+ "author": {
12
+ "name": "Jean-François Robin",
13
+ "email": "robin.jeanfrancois@gmail.com",
14
+ "url": "https://jeanfrancoisrobin.art"
15
15
  },
16
16
  "dependencies": {
17
- "fr.jeanf.propertydrawer": "1.0.5"
17
+ "fr.jeanf.propertydrawer": "1.1.6"
18
18
  },
19
19
  "samples": [
20
- {
21
- "displayName": "Player Channels",
22
- "description": "A set of channels used for the vr_player package",
23
- "path": "Samples/PlayerChannels"
24
- },
25
- {
26
- "displayName": "Event filters",
27
- "description": "A set of filters to segregate messages sent on the same channel",
28
- "path": "Samples/Filters"
29
- }
30
- ]
31
- }
20
+ {
21
+ "displayName": "Player Channels",
22
+ "description": "A set of channels used for the vr_player package",
23
+ "path": "Samples/PlayerChannels"
24
+ },
25
+ {
26
+ "displayName": "Event filters",
27
+ "description": "A set of filters to segregate messages sent on the same channel",
28
+ "path": "Samples/Filters"
29
+ }
30
+ ]
31
+ }