Ejemplo n.º 1
0
 private void StartTask(Node node)
 {
     _aliveBehavior = node;
     if (node is Task)
     {
         RuntimeTask rt = GetRuntimeTask(_aliveBehavior as Task);
         rt.Start();
     }
 }
Ejemplo n.º 2
0
        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]]);
            }
        }
Ejemplo n.º 3
0
 private void OnDisable()
 {
     _aliveBehavior = null;
 }
Ejemplo n.º 4
0
 private void FinishExecuteImmediate()
 {
     FinishDecorators();
     if (_aliveBehavior is Composite)
         FinishComposite(_aliveBehavior as Composite);
     FinishTask();
     _aliveBehavior = _aliveBehavior.parentNode;
 }