Esempio n. 1
0
        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();
            }
        }
Esempio n. 2
0
 protected override void BTStart()
 {
     base.BTStart();
     if (ChildTasks.Length > 0)
     {
         _curTask = ChildTasks[0];
         _curTask.__BTStart();
     }
 }
Esempio n. 3
0
        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();
            }
        }
Esempio n. 4
0
        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;
                }
            }
        }
Esempio n. 5
0
 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);
 }
Esempio n. 6
0
        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();
            }
        }
Esempio n. 7
0
 private void ReInit()
 {
     _curTask = ChildTasks[0];
     _curTask.__BTStart();
 }