You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

22 lines
563 B

This file contains ambiguous Unicode characters!

This file contains ambiguous Unicode characters that may be confused with others in your current locale. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to highlight these characters.

using SampleBehavirTree;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// 只要有一个节点返回Ture则停止检测其他节点运行状态为Ture
/// </summary>
public class Selector : Composite
{
public override IEnumerator Execute()
{
foreach (var node in nodes)
{
yield return BehaviourCtrl.Instance.StartCoroutine(node.Execute());
if (node.state == State.Succeed) yield break;
}
this.state = SampleBehavirTree.State.Fail;
}
}