protected override BTState BTUpdate() { while (true) { if (_curTask == null) { return(AllFinishState); } var state = _curTask.__BTUpdate(); if (state == BTState.Running) { return(BTState.Running); } if (state == OneFinishState) { for (var i = _curTask.Index + 1; i < ChildTasks.Length; i++) { ChildTasks[i].State = BTState.ForceEnd; } return(OneFinishState); } _curTask = _curTask.NextBt; _curTask?.__BTStart(); } }
protected override void BTStart() { base.BTStart(); if (ChildTasks.Length > 0) { _curTask = ChildTasks[0]; _curTask.__BTStart(); } }
protected override BTState BTUpdate() { while (true) { if (_curTask == null) { return(ResultState); } var state = _curTask.__BTUpdate(); if (state == BTState.Running) { return(BTState.Running); } _curTask = _curTask.NextBt; _curTask?.__BTStart(); } }
private void ExecuteChildStart() { var index = GetExecuteIndex(); if (ChildTasks.Length <= index) { Debug.LogError("No exe index"); return; } _exeChildTask = ChildTasks[index]; _exeChildTask.__BTStart(); foreach (var childTask in ChildTasks) { if (childTask != _exeChildTask) { childTask.State = BTState.ForceEnd; } } }
protected override BTState BTUpdate() { if (_curTask == null) { ReInit(); } while (_curTask != null) { var state = _curTask.__BTUpdate(); if (state == BTState.Running) { return(BTState.Running); } if (state == TargetState) { return(TargetState); } _curTask = _curTask.NextBt; _curTask?.__BTStart(); } return(BTState.Running); }
protected override BTState BTUpdate() { if (Time.time < _endTime) { return(BTState.Running); } switch (BTCompareResultType) { case BTCompareType.ExecuteChild: if (!_curTask) { _curTask = ChildTasks[0]; _curTask.__BTStart(); } return(_curTask.__BTUpdate()); case BTCompareType.ReturnResult: return(FinishState); default: throw new ArgumentOutOfRangeException(); } }
private void ReInit() { _curTask = ChildTasks[0]; _curTask.__BTStart(); }