Use extension methods to check BlackboardNotes (or events)
This is a simple example, but it demonstrates how extension methods can make your classes smaller and easier to read.
As seen in the RPG demo project (CreationPortraitImages.c
s & CreationExtensions.cs
), when a BlackboardNote
is passed to a ReceiveChange()
method, we can sipmly call something very easy to read:
In this code, IsNewActorSelected()
is an extension method for BlackboardNote
objects. Check CreationExtensions.cs
to see the code:
In the demo project, we know that the BlackboardNote
which contains the active player information will only be updated (and sent as a notitication) when it changes. So this extension method returns true if the topic and subject of the BlackboardNote
match the topic and subject we have hard coded in the gameData
class.
Last updated