public bool onenter_action(Agent pAgent) { this.m_node.InstantiatePars(pAgent); bool bResult = this.CheckPreconditions(pAgent, false); if (bResult) { this.m_bHasManagingParent = false; this.SetCurrentTask(null); bResult = this.onenter(pAgent); if (!bResult) { return(false); } else { #if !BEHAVIAC_RELEASE //BEHAVIAC_PROFILE_DEBUGBLOCK("Debug", true); BehaviorTask.CHECK_BREAKPOINT(pAgent, this.m_node, "enter", bResult ? EActionResult.EAR_success : EActionResult.EAR_failure); #endif } } return(bResult); }
public void onexit_action(Agent pAgent, EBTStatus status) { this.onexit(pAgent, status); if (this.m_node != null) { Effector.EPhase phase = Effector.EPhase.E_SUCCESS; if (status == EBTStatus.BT_FAILURE) { phase = Effector.EPhase.E_FAILURE; } else { Debug.Check(status == EBTStatus.BT_SUCCESS); } this.m_node.ApplyEffects(pAgent, phase); } #if !BEHAVIAC_RELEASE if (Config.IsLoggingOrSocketing) { //BEHAVIAC_PROFILE_DEBUGBLOCK("Debug", true); if (status == EBTStatus.BT_SUCCESS) { BehaviorTask.CHECK_BREAKPOINT(pAgent, this.m_node, "exit", EActionResult.EAR_success); } else { BehaviorTask.CHECK_BREAKPOINT(pAgent, this.m_node, "exit", EActionResult.EAR_failure); } } #endif }
public static bool UpdateTransitions(Agent pAgent, BehaviorNode node, List <Transition> transitions, ref int nextStateId, EBTStatus result) { bool bTransitioned = false; if (transitions != null) { for (int i = 0; i < transitions.Count; ++i) { Transition transition = transitions[i]; if (transition.Evaluate(pAgent, result)) { nextStateId = transition.TargetStateId; Debug.Check(nextStateId != -1); //transition actions transition.ApplyEffects(pAgent, Effector.EPhase.E_BOTH); #if !BEHAVIAC_RELEASE if (Config.IsLoggingOrSocketing) { BehaviorTask.CHECK_BREAKPOINT(pAgent, node, "transition", EActionResult.EAR_none); } #endif bTransitioned = true; break; } } } return(bTransitioned); }
private PlannerTask BuildPlan(Task root) { LogManager.PLanningClearCache(); int depth = this.agent.Variables.Depth; PlannerTask rootTask = null; using (var currentState = this.agent.Variables.Push(true)) { this.agent.PlanningTop = this.agent.Variables.Top; Debug.Check(this.agent.PlanningTop >= 0); LogPlanBegin(this.agent, root); rootTask = this.decomposeNode(root, 0); LogPlanEnd(this.agent, root); #if !BEHAVIAC_RELEASE BehaviorTask.CHECK_BREAKPOINT(this.agent, root, "plan", EActionResult.EAR_all); #endif this.agent.PlanningTop = -1; } Debug.Check(this.agent.Variables.Depth == depth); return(rootTask); }