本文整理汇总了C#中behaviac.BehaviorNode.ApplyEffects方法的典型用法代码示例。如果您正苦于以下问题:C# BehaviorNode.ApplyEffects方法的具体用法?C# BehaviorNode.ApplyEffects怎么用?C# BehaviorNode.ApplyEffects使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类behaviac.BehaviorNode
的用法示例。
在下文中一共展示了BehaviorNode.ApplyEffects方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: decomposeNode
public PlannerTask decomposeNode(BehaviorNode node, int depth)
{
try
{
// Ensure that the planner does not get stuck in an infinite loop
if (depth >= 256)
{
Debug.LogError("Exceeded task nesting depth. Does the graph contain an invalid cycle?");
return null;
}
LogPlanNodeBegin(this.agent, node);
int depth1 = this.agent.Variables.Depth;
PlannerTask taskAdded = null;
bool isPreconditionOk = node.CheckPreconditions(this.agent, false);
if (isPreconditionOk)
{
bool bOk = true;
taskAdded = PlannerTask.Create(node, this.agent);
if (node is Action)
{
//nothing to do for action
Debug.Check(true);
}
else
{
Debug.Check(taskAdded is PlannerTaskComplex);
PlannerTaskComplex seqTask = taskAdded as PlannerTaskComplex;
bOk = this.decomposeComplex(node, seqTask, depth);
}
if (bOk)
{
node.ApplyEffects(this.agent, Effector.EPhase.E_SUCCESS);
}
else
{
BehaviorTask.DestroyTask(taskAdded);
taskAdded = null;
}
}
else
{
//precondition failed
LogPlanNodePreconditionFailed(this.agent, node);
}
LogPlanNodeEnd(this.agent, node, taskAdded != null ? "success" : "failure");
Debug.Check(this.agent.Variables.Depth == depth1);
return taskAdded;
}
catch (Exception ex)
{
Debug.Check(false, ex.Message);
}
return null;
}