So today I’m writing some extensions to AngryAnt Behave
http://angryant.com/behave/
Namely some implementations of various Decorators for easy re-use across libraries.
As well as something I thought would be useful. The ability to use ‘yield’ in your action/decorator ticks. As well as a collection of yield instructions similar to the coroutine yield instructions like WaitForSeconds.
This way you can write an action like so:
public System.Collections.IEnumerable YieldFooAction(Tree sender)
{
//do some stuff
yield return BehaveResult.Running;
//do some more sutff NEXT tick
yield return YieldForTicks(5);//wait 5 ticks
//do even more stuff after 5 ticks of doing nothing
yield return YieldForSeconds(1); //wait 1 second
//finish up
}
You wouldn’t even have to return a final success because on completion it’s treated as a success.
What does everyone think? Would anyone like me to share this when I’m done?
Also share any decorators that you think would be useful. So far I just have generics like:
Repeat (repeat so many time)
TimedRepeat (repeat for so much time)
ExitIf (fails if parameter met)
ContinueIf (succeeds if parameter met)
Wait (blocks for so much time/ticks)