예제 #1
0
 private void StartTask(Node node)
 {
     _aliveBehavior = node;
     if (node is Task)
     {
         RuntimeTask rt = GetRuntimeTask(_aliveBehavior as Task);
         rt.Start();
     }
 }
예제 #2
0
파일: Brain.cs 프로젝트: ppugend/UniBt
        public void StartNode(Node node)
        {
            _aliveBehavior = node;
            if (node.decorators.Length > 0)
            {
                for (int i = 0; i < node.decorators.Length; i++)
                {
                    RuntimeDecorator rd = GetRuntimeDecorator(node.decorators[i]);
            #if UNITY_EDITOR
                    rd.closed = false;
            #endif
                    if (!StartDecorator(rd))
                    {
                        FinishExecute(false);
                        return;
                    }
                }
            }

            if (node is Task)
            {
                StartTask(node);
            }
            else
            {
                if (node is Composite)
                {
                    if ((node as Composite).services.Length > 0)
                    {
                        for (int i = 0; i < _runtimeServices.Count; i++)
                            if (_runtimeServices[i].parent == node as Composite)
                                StartService(_runtimeServices[i]);
                    }
                    if (node.childNodes.Length == 0)
                    {
                        if (node is Selector)
                            FinishExecute(true);
                        else if (node is Sequence)
                            FinishExecute(false);
                    }
                }

                if (_currentChildNodeIndex[node] < node.childNodes.Length)
                    StartNode(node.childNodes[_currentChildNodeIndex[node]]);
            }
        }
예제 #3
0
파일: Brain.cs 프로젝트: nicecapj/UniBt
 private void OnDisable()
 {
     _aliveBehavior = null;
 }
예제 #4
0
파일: Brain.cs 프로젝트: nicecapj/UniBt
 private void FinishExecuteImmediate()
 {
     FinishDecorators();
     if (_aliveBehavior is Composite)
         FinishComposite(_aliveBehavior as Composite);
     FinishTask();
     _aliveBehavior = _aliveBehavior.parentNode;
 }