Roman aa6e1ebe90 任务:创建项目,引入部分将会用到的插件和包
1.引入URP
2.引入InputSystem
3.引入Fungus
4.引入DoTween
5.引入CinemaMachine
6.引入BehaviorTree
7.引入BehaviorTree动作包
8.配置了渲染管线资源

🥵🥵🥵🥵🥵
2021-11-21 15:14:51 +08:00

45 lines
1.8 KiB
C#

namespace BehaviorDesigner.Runtime.Tasks
{
[TaskDescription("The selector task is similar to an \"or\" operation. It will return success as soon as one of its child tasks return success. " +
"If a child task returns failure then it will sequentially run the next task. If no child task returns success then it will return failure.")]
[TaskIcon("{SkinColor}SelectorIcon.png")]
public class Selector : Composite
{
// The index of the child that is currently running or is about to run.
private int currentChildIndex = 0;
// The task status of the last child ran.
private TaskStatus executionStatus = TaskStatus.Inactive;
public override int CurrentChildIndex()
{
return currentChildIndex;
}
public override bool CanExecute()
{
// We can continue to execuate as long as we have children that haven't been executed and no child has returned success.
return currentChildIndex < children.Count && executionStatus != TaskStatus.Success;
}
public override void OnChildExecuted(TaskStatus childStatus)
{
// Increase the child index and update the execution status after a child has finished running.
currentChildIndex++;
executionStatus = childStatus;
}
public override void OnConditionalAbort(int childIndex)
{
// Set the current child index to the index that caused the abort
currentChildIndex = childIndex;
executionStatus = TaskStatus.Inactive;
}
public override void OnEnd()
{
// All of the children have run. Reset the variables back to their starting values.
executionStatus = TaskStatus.Inactive;
currentChildIndex = 0;
}
}
}