(copied from lucera blog)
MindShakes provides an easy way to communicate between different behaviors through messages.
When you are splitting the logic between different behaviors, you don't need to worry about how these behaviors will handle their visibility. If you need that several behaviors communicate, you can use the IBC system.
All behaviors have a virtual method to be used to receive messages from the behavior manager. The name of this method is "Notification". A behavior only can receive notifications for those messages for which it has been registered. To do that you must use the method "RegisterNotification", from the behavior manager, where you must specify the notification id and the behavior instance that will receive the notification. Then, when the method "SendNotification", from the behavior manager, will be invoked, the "Notification" method, for each behavior that has been subscribed to this message id, will be invoked.
Notice that you must overwrite the "Notification" method on your behavior, if you want to handle any notification.
Gift of the Magi
Hace 13 años
No hay comentarios:
Publicar un comentario