Skip to content

Commit 38ce5ec

Browse files
Added documentation
1 parent d5b6a07 commit 38ce5ec

File tree

5 files changed

+72
-0
lines changed

5 files changed

+72
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
## Introduction
2+
Event Listeners are components that listen to a specific Event and then provides a response in the form on a UnityEvent. Note that the type of event listener must match the event type, so if a bool event is expected, you must use an EventListener of type bool as well. Typed events listeners also supports forwarding the raise parameter as a dynamic response
3+
4+
Event listeners are also fully debuggable through a variety of features. A fully featured stacktrace window is available. You can also simulate an incoming event through the inspector, and even select a debug value if the listener is typed. When an event is raised, a gizmo is also drawn to visualize responses
5+
6+
## Script Reference
7+
The class has a singular function for responding to an event. It differs depending on if a type is expected or not
8+
9+
void OnEventRaised(T)
10+
void OnEventRaised()
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Introduction
2+
3+
Events also exist as ScriptableObjects in your project. They can contain any single parameter when raising or none. Events are also fully debuggable through the editor using the stacktrace window and the raise button functionality, which also supports the ability to raise events with parameters. If a parameter is specified, a field will be present which allows you to select which value will be passed.
4+
5+
## Script Reference
6+
Note that you must provide an Event Listener in order to subscribe to events
7+
8+
The base class differs depending on whether an argument is expected or not
9+
10+
void Raise(T)
11+
void RegisterListener(IGameEventListener<T>)
12+
void UnregisterListener(IGameEventListener<T>)
13+
14+
void Raise()
15+
void RegisterListener(IGameEventListener)
16+
void UnregisterListener(IGameEventListener)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Introduction
2+
References are how we expose fields in MonoBehaviour scripts that allow us to assign a variable ScriptableObject. They're wrapped in a separate class because you can also choose not to use a ScriptableObject at all, and instead write a constant value in the inspector.
3+
4+
## Script Reference
5+
To create a Reference field in your MonoBehaviour script, simply declare it like you would any other field
6+
7+
public BoolReference boolValue;
8+
9+
Or use the [SerializeField] attribute if it's not public
10+
11+
[SerializeField]
12+
private BoolReference boolValue;
13+
14+
You don't have to care whether the Reference is using a constant or a variable, simply reference the Value property
15+
16+
T Value { get; set; }
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
## Introduction
2+
Runtime Sets are simply a collection of objects that are assigned during runtime. Note that the inspector is merely there for debugging purposes, and not supposed to let you drag data into the set. You can see all objects within the set, click on them to see where they are in the scene view, and even remove entries.
3+
4+
## Script Reference
5+
There are various ways to interact with the runtime set. Available are the following members
6+
7+
T this[int index]
8+
9+
IList Items { get; }
10+
int Count { get; }
11+
Type Type { get; }
12+
13+
void Add(T)
14+
void Remove(T)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
## Introduction
2+
Variable ScriptableObject's share a lot of similarities with C# variables. They can be named and contain values of different types. Since they're embedded into a ScriptableObject, which exists as an asset within Unity, modifying both the name and value is very simple and intuitive.
3+
4+
## Script Reference
5+
Variables have a single property and a couple of functions we can use to modify its value.
6+
7+
Value { get; set; }
8+
9+
SetValue(T)
10+
SetValue(BaseVariable<T>)
11+
12+
Variables also have a single operator
13+
14+
implicit operator T(BaseVariable<T>)
15+
16+
The reason why you can't implicitly or explicitly assign any value, is because Variables are objects themselves, so it must be clear whether you're changing the reference or the value.

0 commit comments

Comments
 (0)