/// <summary> /// Re evalate BT /// </summary> /// <returns>result status</returns> internal Status Think() { Status status; LastRunningNode = null; status = _root.Update(this); if (status == Status.Running) { //save current BT state for next time //swap var tmp = _lastRunningPath; _lastRunningPath = _currentPath; _currentPath = tmp; } else { _lastRunningPath.Clear(); } _currentPath.Clear(); return(status); }
public OptionalActionNode(ActionNode <TBlackboard> child, bool startSuccessRequired) : base("Optional_" + child.Name) { _child = child; _startSuccessRequired = startSuccessRequired; }
/// <summary> /// Create Optional action node /// </summary> /// <param name="child">Optional action</param> /// <returns>ActionNode</returns> public ActionNode <TBlackboard> Optional(ActionNode <TBlackboard> child) { ActionNode <TBlackboard> node = new OptionalActionNode <TBlackboard>(child, false); return(node); }
/// <summary> /// Create Optional action node /// </summary> /// <param name="child">Optional action</param> /// <param name="startSuccessRequired">If False action will starts even if child.Start failed</param> /// <returns>ActionNode</returns> public ActionNode <TBlackboard> Optional(ActionNode <TBlackboard> child, bool startSuccessRequired) { ActionNode <TBlackboard> node = new OptionalActionNode <TBlackboard>(child, startSuccessRequired); return(node); }