Nowhere in the description did you explain how the referencing is done. How does the player know who the AI is? What if there are 10 AIs - how do we know which one to command?
The interface has an blank input node and blank output node. Just using it to be able to reference the code among different characters.
Can’t wrap my mind around this.
Not sure if what’s below helps but, at the most fundamental level, the setup could be as follows:
- a character up on the right, AI Sphere drone in the bottom left:
Above, the exposed AI Drone variable allows me to reference something from the scene (there are other ways to reference, too). Below, we trace along the camera vector and use the previously set reference to tell the AI to move on the navmesh:
- and the drone can zip around:
No interface or dispatcher is needed here. Interface makes communicating between unrelated classes easier. Dispatchers are mainly for call-backs.
The question stands - how do you reference the AI in the Player. Once you have the reference, you can send a message through the interface, sure. But we need to know who to send it to first. How do we know that?