com.pakforge.eventcontainers 0.0.2

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.
@@ -0,0 +1,7 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ [CreateAssetMenu(menuName = "PakForge/EventChannels/BoolEventChannel", fileName = "BoolEventChannel")]
6
+ public class BoolEventChannel : EventChannel<bool> { }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 3a2b755798a04b98ba402bda58acb1ba
3
+ timeCreated: 1770595254
@@ -0,0 +1,7 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ [CreateAssetMenu(menuName = "PakForge/EventChannels/EmptyEventChannel", fileName = "EmptyEventChannel")]
6
+ public class EmptyEventChannel : EventChannel { }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 842fc322a81845889fb0ce0054b47536
3
+ timeCreated: 1770595355
@@ -0,0 +1,78 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ /// <summary>
6
+ /// Base class to maintain and raise events with no arguments
7
+ /// </summary>
8
+ public abstract class EventChannel : ScriptableObject
9
+ {
10
+ public delegate void ChannelEvent();
11
+ private event ChannelEvent EventRaised;
12
+
13
+ private void OnEnable() => EventRaised = null;
14
+ private void OnDisable() => EventRaised = null;
15
+
16
+ public void RaiseEvent() => EventRaised?.Invoke();
17
+
18
+ public void Add(ChannelEvent channelEvent) => EventRaised += channelEvent;
19
+ public void Remove(ChannelEvent channelEvent) => EventRaised -= channelEvent;
20
+ }
21
+
22
+ /// <summary>
23
+ /// Base class to maintain and raise events with one argument
24
+ /// </summary>
25
+ /// <typeparam name="T">Value argument to pass</typeparam>
26
+ public abstract class EventChannel<T> : ScriptableObject
27
+ {
28
+ public delegate void ChannelEvent(T arg);
29
+ private event ChannelEvent EventRaised;
30
+
31
+ private void OnEnable() => EventRaised = null;
32
+ private void OnDisable() => EventRaised = null;
33
+
34
+ public void RaiseEvent(T arg) => EventRaised?.Invoke(arg);
35
+
36
+ public void Add(ChannelEvent channelEvent) => EventRaised += channelEvent;
37
+ public void Remove(ChannelEvent channelEvent) => EventRaised -= channelEvent;
38
+ }
39
+
40
+ /// <summary>
41
+ /// Base class to maintain and raise events with one argument
42
+ /// </summary>
43
+ /// <typeparam name="T1">First value argument to pass</typeparam>
44
+ /// <typeparam name="T2">Second value argument to pass</typeparam>
45
+ public abstract class EventChannel<T1, T2> : ScriptableObject
46
+ {
47
+ public delegate void ChannelEvent(T1 arg1, T2 arg2);
48
+ private event ChannelEvent EventRaised;
49
+
50
+ private void OnEnable() => EventRaised = null;
51
+ private void OnDisable() => EventRaised = null;
52
+
53
+ public void RaiseEvent(T1 arg1, T2 arg2) => EventRaised?.Invoke(arg1, arg2);
54
+
55
+ public void Add(ChannelEvent channelEvent) => EventRaised += channelEvent;
56
+ public void Remove(ChannelEvent channelEvent) => EventRaised -= channelEvent;
57
+ }
58
+
59
+ /// <summary>
60
+ /// Base class to maintain and raise events with one argument
61
+ /// </summary>
62
+ /// <typeparam name="T1">First value argument to pass</typeparam>
63
+ /// <typeparam name="T2">Second value argument to pass</typeparam>
64
+ /// <typeparam name="T3">Third value argument to pass</typeparam>
65
+ public abstract class EventChannel<T1, T2, T3> : ScriptableObject
66
+ {
67
+ public delegate void ChannelEvent(T1 arg1, T2 arg2, T3 arg3);
68
+ private event ChannelEvent EventRaised;
69
+
70
+ private void OnEnable() => EventRaised = null;
71
+ private void OnDisable() => EventRaised = null;
72
+
73
+ public void RaiseEvent(T1 arg1, T2 arg2, T3 arg3) => EventRaised?.Invoke(arg1, arg2, arg3);
74
+
75
+ public void Add(ChannelEvent channelEvent) => EventRaised += channelEvent;
76
+ public void Remove(ChannelEvent channelEvent) => EventRaised -= channelEvent;
77
+ }
78
+ }
@@ -0,0 +1,2 @@
1
+ fileFormatVersion: 2
2
+ guid: 90d252e041bc28f4488c65841cd62dc1
@@ -0,0 +1,7 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ [CreateAssetMenu(menuName = "PakForge/EventChannels/FloatEventChannel", fileName = "FloatEventChannel")]
6
+ public class FloatEventChannel : EventChannel<float> { }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 7e05518a22de48619fb33ec921ba575e
3
+ timeCreated: 1770595075
@@ -0,0 +1,7 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ [CreateAssetMenu(menuName = "PakForge/EventChannels/IntEventChannel", fileName = "IntEventChannel")]
6
+ public class IntEventChannel : EventChannel<int> { }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: d8972ff3adfd4dc2a3b8161700e87372
3
+ timeCreated: 1770595012
@@ -0,0 +1,7 @@
1
+ using UnityEngine;
2
+
3
+ namespace PakForge.EventContainers
4
+ {
5
+ [CreateAssetMenu(menuName = "PakForge/EventChannels/StringEventChannel", fileName = "StringEventChannel")]
6
+ public class StringEventChannel : EventChannel<string> { }
7
+ }
@@ -0,0 +1,3 @@
1
+ fileFormatVersion: 2
2
+ guid: 9d5ac2084cc84eb5a8a583592e24bfb1
3
+ timeCreated: 1770595114
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "com.pakforge.eventcontainers",
3
+ "rootNamespace": "PakForge.EventContainers",
4
+ "references": [],
5
+ "includePlatforms": [],
6
+ "excludePlatforms": [],
7
+ "allowUnsafeCode": false,
8
+ "overrideReferences": false,
9
+ "precompiledReferences": [],
10
+ "autoReferenced": true,
11
+ "defineConstraints": [],
12
+ "versionDefines": [],
13
+ "noEngineReferences": false
14
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: bb6f2e9b62073694c84bd5b83219238a
3
+ AssemblyDefinitionImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant:
package/Runtime.meta ADDED
@@ -0,0 +1,8 @@
1
+ fileFormatVersion: 2
2
+ guid: b812c91359ce0244bba56338c3ba9a42
3
+ folderAsset: yes
4
+ DefaultImporter:
5
+ externalObjects: {}
6
+ userData:
7
+ assetBundleName:
8
+ assetBundleVariant:
package/package.json ADDED
@@ -0,0 +1,14 @@
1
+ {
2
+ "name": "com.pakforge.eventcontainers",
3
+ "displayName": "PakForge EventContainers",
4
+ "description": "Event bus system through ScriptableObjects",
5
+ "version": "0.0.2",
6
+ "unity": "6000.3",
7
+ "author": {
8
+ "name": "Marc Robbins",
9
+ "email": "marccrobbins@gmail.com"
10
+ },
11
+ "hideInEditor": false,
12
+ "type": "library",
13
+ "dependencies": {}
14
+ }
@@ -0,0 +1,7 @@
1
+ fileFormatVersion: 2
2
+ guid: 87f94ac36ebd9f64ea62731942e64d98
3
+ PackageManifestImporter:
4
+ externalObjects: {}
5
+ userData:
6
+ assetBundleName:
7
+ assetBundleVariant: