Implementation of behavior tree.