I have a parralel composite which will scan for user actions, one of which is the EndTurn action which will wrap up the players turn and give control to the next player.
Trying to do this i am experiencing some difficulties using a “check c# event” condition. I have added an EventHandler to my behaviour which will be invoked when clicking a UI button. I would like to “catch” the invoked handler and act accordingly.
1
2
3
4
5
6
publiceventEventHandler EndTurn;
publicvoidOnEndTurn()
{
EventHandler handler=EndTurn;
if(handler!=null)handler(this,EventArgs.Empty);
}
The problem is that the delegate is not added to the inocation list of the eventhandler. An exception is thrown wil attempting to create the delegate from within the condition.
Apparently it was EventArgs that were causing the issue. I opted for a different direction creating my own custom condition assigning the delegate to the behaviour manually. Which works like a charm.
Consider it closed 😉
Author
Posts
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic.
Login
Register
By registering on this website you agree to our Privacy Policy.