Interfaces allow communication between objects. You can think of Interfaces as expanded Broadcasters.
Interfaces always need a target to function.
On the implementation node, the target is usually the object the interface is implemented in. For the caller node, the target is usually pushed, for example, from the Collision Detector.
New interfaces are created by selecting Edit in the Interface Caller or Interface Implementation node.
You can have as many inputs and return outputs as you want, and these can have different Data Types.
Interface Caller calls the selected interface.
Target
defines the target object for the Interface call. Optionally, Channel
can be used to further limit which Interface Implementation is called.
Interface Caller will pass the input values to the Interface Implementation and you can optionally get values back from output links.
Interface caller will also output how many Implementations with matching Target
& Channel
have been found.
Interfaces Implementation gets executed when Interface Caller with matching Target
and Channel
is executed. It gets the data from the Interface Caller inputs.
Optionally, you can return data from Interface Implementation inputs to Interface Caller.
In this example, the HypeHype cube is the player, and it kills the enemy gray cubes, earning XP points.
When the player collides with the enemy, the enemy is set as a target for the interface, and then it executes the damage, which is then passed to the collided enemy.
On the enemy, we check how much damage has been dealt, and if it's higher than its health, we execute the XP and pass it back using the Interface Implementation.