Action queue/chaining implementation

tetto_green

New member
Hello,
I am going to implement action queue for my AI units. It's similar to starcraft shift+command mechanic: for example, I want to be able to add seek point, then after it's complete to attack and then after it's complete to seek point b. All these actions should be dynamically ordered so they can't be hardcoded in one behaviour.

After research of documentation the solutions seems to pool external behaviours from monobehaviour and add them as not running behaviour tree components to the target object. Then chaining them by subsrubing one behaviour tree to another like that:

Code:
previousAction.OnBehaviorEnd += currentAction.EnableBehavior;

Is this approach good or is there a better way to do that?
 
Since you want to dynamically decide which set of logic is run next using the OnBehaviorEnd callback is a great solution.
 
Top