Exemple #1
0
            public PlanningState(string fullId, string nodeId, PlanningState parent) {
                this._id = fullId;
                this._nodeId = nodeId;
                this._parent = parent;

                if (parent != null) {
                    if (parent._id.IndexOf("DecoratorIterator[") >= 0 && parent._index == -1 && fullId.IndexOf("+") == -1) {
                        Debug.Check(true);
                    }

                    parent._children.Add(this);
                }
            }
Exemple #2
0
            public PlanningState(string fullId, string nodeId, PlanningState parent)
            {
                this._id     = fullId;
                this._nodeId = nodeId;
                this._parent = parent;

                if (parent != null)
                {
                    if (parent._id.IndexOf("DecoratorIterator[") >= 0 && parent._index == -1 && fullId.IndexOf("+") == -1)
                    {
                        Debug.Check(true);
                    }

                    parent._children.Add(this);
                }
            }
Exemple #3
0
        private static PlanningState SetCurrentState(string btId)
        {
            string nodeId = ParseNodeId(btId);

            if (PlanningProcess._planning._currentState != null && PlanningProcess._planning._parentNodeIds.Count > 0)
            {
                int n = PlanningProcess._planning._parentNodeIds.Count;

                for (int i = n - 1; i >= 0; --i)
                {
                    nodeId = string.Format("{0}:{1}", PlanningProcess._planning._parentNodeIds[i], nodeId);
                }
            }

            if (PlanningProcess._planning._currentState != null &&
                PlanningProcess._planning._currentState._id == btId && PlanningProcess._planning._currentState._nodeId == nodeId)
            {
                return(PlanningProcess._planning._currentState);
            }

            //bool bForEachChild = false;
            if (PlanningProcess._planning._currentState != null && PlanningProcess._planning._currentState._index != -1)
            {
                Debug.Check(PlanningProcess._planning._currentState._count != -1);
                //bForEachChild = true;
            }

            PlanningState parentState = PlanningProcess._planning._currentState;
            PlanningState newState    = new PlanningState(btId, nodeId, parentState);

            if (!PlanningProcess._planning._states.ContainsKey(nodeId))
            {
                PlanningProcess._planning._states.Add(nodeId, newState);
            }
            else
            {
                PlanningProcess._planning._states[nodeId] = newState;
            }

            PlanningProcess._planning._currentState = newState;

            return(newState);
        }
Exemple #4
0
            //find the last recent parent which contains state data if the current one has no data
            public PlanningState GetLastNode(NodeViewData nvd)
            {
                while (nvd != null && !_states.ContainsKey(nvd.FullId))
                {
                    nvd = nvd.Parent;
                }

                if (nvd != null && _states.ContainsKey(nvd.FullId))
                {
                    PlanningState ps = _states[nvd.FullId];

                    while (ps != null && ps._agents.Count == 0)
                    {
                        ps = ps._parent;
                    }

                    return(ps);
                }

                return(null);
            }
Exemple #5
0
        private static PlanningState SetCurrentState(string btId) {
            string nodeId = ParseNodeId(btId);

            if (PlanningProcess._planning._currentState != null && PlanningProcess._planning._parentNodeIds.Count > 0) {
                int n = PlanningProcess._planning._parentNodeIds.Count;

                for (int i = n - 1; i >= 0; --i) {
                    nodeId = string.Format("{0}:{1}", PlanningProcess._planning._parentNodeIds[i], nodeId);
                }
            }

            if (PlanningProcess._planning._currentState != null &&
                PlanningProcess._planning._currentState._id == btId && PlanningProcess._planning._currentState._nodeId == nodeId) {
                return PlanningProcess._planning._currentState;
            }

            //bool bForEachChild = false;
            if (PlanningProcess._planning._currentState != null && PlanningProcess._planning._currentState._index != -1) {
                Debug.Check(PlanningProcess._planning._currentState._count != -1);
                //bForEachChild = true;
            }

            PlanningState parentState = PlanningProcess._planning._currentState;
            PlanningState newState = new PlanningState(btId, nodeId, parentState);

            if (!PlanningProcess._planning._states.ContainsKey(nodeId)) {
                PlanningProcess._planning._states.Add(nodeId, newState);

            } else {
                PlanningProcess._planning._states[nodeId] = newState;
            }

            PlanningProcess._planning._currentState = newState;

            return newState;
        }