I already took a look at TreeSharp and it's too complicated/advanced for my likings so I coded a simpler behavior tree myself so that's not the problem at all, it's the methode of persisting the created behavior tree im having trouble with...
For example, my node looks like this:
Code:
public class Node : INode
{
public Node(Func<Result> condition, Func<Result> action)
{
Condition = condition;
Action = action;
}
public Func<Result> Condition { get; set; }
public Func<Result> Action { get; set; }
public Result Run()
{
var condition = Condition();
if (condition == Result.True | condition == Result.Sucsess)
return Action();
else
return Result.False;
}
}
The problem here is how to transfer the two Func<Result> delegates from the analyzed dll, on the top of my head i can figure out two ways: Store the name and save it in a xml structure and analyze the dll again inside the bot and create an instance of the class and map the functions that way OR serialize the whole shit but that would require the external classes to be marked for serialization...