|
|
|
|
|
using System;
|
|
|
|
|
|
using CleverCrow.Fluid.BTs.Tasks;
|
|
|
|
|
|
|
|
|
|
|
|
namespace Game
|
|
|
|
|
|
{
|
|
|
|
|
|
public partial class AIObjectBase<T> where T : new()
|
|
|
|
|
|
{
|
|
|
|
|
|
protected enum ETaskStatus
|
|
|
|
|
|
{
|
|
|
|
|
|
Success,
|
|
|
|
|
|
Failure,
|
|
|
|
|
|
Continue
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Selector(Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
Selector("selector", action);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Selector(string name, Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.Selector(name);
|
|
|
|
|
|
action();
|
|
|
|
|
|
_builder.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Sequence(Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
Sequence("sequence", action);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Sequence(string name, Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.Sequence(name);
|
|
|
|
|
|
action();
|
|
|
|
|
|
_builder.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Do(string name, Func<ETaskStatus> action, Func<string> into = null)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.Do(name, () => (TaskStatus)action(), into);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void Condition(string name, Func<bool> action)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.Condition(name, action);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void WaitTimeCheck(string name, float time)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.WaitTimeCheck(name, time);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void WaitTimeCheckDynamic(string name, Func<float> time)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.WaitTimeCheckDynamic(name, time);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void ReturnSuccess(Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.ReturnSuccess();
|
|
|
|
|
|
action();
|
|
|
|
|
|
_builder.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
protected void ReturnFailure(Action action)
|
|
|
|
|
|
{
|
|
|
|
|
|
_builder.ReturnFailure();
|
|
|
|
|
|
action();
|
|
|
|
|
|
_builder.End();
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|