Пример #1
0
    public static string GetTitle(NODE_TYPE nodeType)
    {
        int    index = EnumNames.GetEnumIndex <NODE_TYPE>(nodeType);
        string title = EnumNames.GetEnumName <NODE_TYPE>(index);

        return(title);
    }
Пример #2
0
        public ZNodeDecorator(ZNodeTree nodeTree, Rect wr, NODE_TYPE decoratorType) : base(BASE_TYPE.DECORATOR, nodeTree, wr)
        {
            nodeType = decoratorType;

            _imgStyle.normal.background = NodeEditor.SkinItem.GetDecoratorNodeImage(nodeType) as Texture2D;
            _inspectorName = nodeType.ToString();
        }
Пример #3
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="name"></param>
 /// <param name="identification"></param>
 public CustomIdentification(string name, IDENTIFICATION identification, Type t, NODE_TYPE nodeType)
 {
     this.name           = name;
     this.identification = identification;
     this.type           = t;
     this.nodeType       = nodeType;
 }
Пример #4
0
        public ZNodeComposite(ZNodeTree nodeTree, Rect wr, NODE_TYPE compositeType) : base(BASE_TYPE.COMPOSITE, nodeTree, wr)
        {
            nodeType = compositeType;

            _imgStyle.normal.background = NodeEditor.SkinItem.GetCompositeNodeImage(nodeType) as Texture2D;
            _inspectorName = nodeType.ToString();
        }
Пример #5
0
        //check to see if the player could jump or fall between the provided nodes
        private static CONNECTION_TYPE GetConnectionBetween(NODE_TYPE sourceNodeType, NODE_TYPE destNodeType, Physics.Vector2D sourceNodePosition, Physics.Vector2D destinationNodePosition)
        {
            //a fall node should never be the destination of a jump or a fall, just the sourcepoint for a fall
            if (destNodeType == NODE_TYPE.FALL)
            {
                return(CONNECTION_TYPE.NONE);
            }

            Physics.Player        examplePlayer = new Physics.Player();
            Physics.PhysicsEngine physEng       = Physics.PhysicsEngine.GetPhysicsEngine();

            //if a fall connection is possible, return it
            if ((sourceNodeType == NODE_TYPE.FALL ||
                 sourceNodeType == NODE_TYPE.WALL) &&
                physEng.CanPlayerFallFromTo(examplePlayer, sourceNodePosition, destinationNodePosition))
            {
                return(CONNECTION_TYPE.FALL);
            }

            //if a jump connection is possible, return it
            if ((sourceNodeType == NODE_TYPE.FLOOR ||
                 sourceNodeType == NODE_TYPE.WALL) &&
                physEng.CanPlayerJumpFromTo(examplePlayer, sourceNodePosition, destinationNodePosition))
            {
                return(CONNECTION_TYPE.JUMP);
            }

            return(CONNECTION_TYPE.NONE);
        }
Пример #6
0
 private E_CLOSURE_NODE(NODE_TYPE assignedType, int ID)
 {
     nodeType   = assignedType;
     NodeID     = ID;
     this.edges = new List <EDGE>();
     NFANodes   = new List <NODE>();
 }
Пример #7
0
    public void AddNodeType(NODE_TYPE nodeType)
    {
        Node_Draw_Info_Item item = new Node_Draw_Info_Item(nodeType);

        item.GetTypeName();
        string name = string.Format("{0}/{1}", _nodeTypeName, item._nodeName);
        KeyValuePair <string, Node_Draw_Info_Item> kv = new KeyValuePair <string, Node_Draw_Info_Item>(name, item);

        _nodeArr.Add(kv);
    }
Пример #8
0
        public static ZNode CreateNode(NODE_TYPE nodeType, ZNodeTree nodeTree, Rect nodeRect, JSON js)
        {
            ZNode node = null;

            if (nodeType == NODE_TYPE.REPEATER)
            {
                node = new ZBTRepeater(nodeTree, nodeRect);
            }

            return(node);
        }
Пример #9
0
    // Edit this function when creating new nodes
    public static ZNode CreateNode(NODE_TYPE actionNodeType, ZNodeTree nodeTree, Rect nodeRect, JSON js)
    {
        ZNode node = null;

        if (actionNodeType == NODE_TYPE.SCALE)
        {
            node = new ZBTActionScale(nodeTree, nodeRect, js);
        }

        return(node);
    }
Пример #10
0
        private void InitInfoList()
        {
            #region Node
            // 组合节点
            string         compositeName     = string.Format("{0}/{1}", "Add Node", "组合节点");
            Node_Draw_Info compositeDrawInfo = new Node_Draw_Info(compositeName);
            infoList.Add(compositeDrawInfo);

            // 修饰节点
            string         decoratorName     = string.Format("{0}/{1}", "Add Node", "修饰节点");
            Node_Draw_Info decoratorDrawInfo = new Node_Draw_Info(decoratorName);
            infoList.Add(decoratorDrawInfo);

            // 条件节点
            string         conditionName     = string.Format("{0}/{1}", "Add Node", "条件节点");
            Node_Draw_Info conditionDrawInfo = new Node_Draw_Info(conditionName);
            infoList.Add(conditionDrawInfo);

            // 行为节点
            string         actionName     = string.Format("{0}/{1}", "Add Node", "行为节点");
            Node_Draw_Info actionDrawInfo = new Node_Draw_Info(actionName);
            infoList.Add(actionDrawInfo);

            Node_Draw_Info subTreeDrawInfo = new Node_Draw_Info("AddSubTree");
            infoList.Add(subTreeDrawInfo);

            Dictionary <string, ICustomIdentification <AbstractNode> > nodeDic = BehaviorConfigNode.Instance.GetNodeDic();
            foreach (var kv in nodeDic)
            {
                ICustomIdentification <AbstractNode> customIdentification = kv.Value;
                NODE_TYPE nodeType = (NODE_TYPE)customIdentification.NodeType;
                if ((int)nodeType >= (int)NODE_TYPE.SUB_TREE)
                {
                    subTreeDrawInfo.AddNodeType(nodeType, customIdentification.Name, customIdentification.IdentificationName);
                }
                else if ((int)nodeType >= (int)NODE_TYPE.ACTION)
                {
                    actionDrawInfo.AddNodeType(nodeType, customIdentification.Name, customIdentification.IdentificationName);
                }
                else if ((int)nodeType >= (int)NODE_TYPE.CONDITION)
                {
                    conditionDrawInfo.AddNodeType(nodeType, customIdentification.Name, customIdentification.IdentificationName);
                }
                else if ((int)nodeType >= (int)NODE_TYPE.DECORATOR_INVERTER)
                {
                    decoratorDrawInfo.AddNodeType(nodeType, customIdentification.Name, customIdentification.IdentificationName);
                }
                else if ((int)nodeType >= (int)NODE_TYPE.SELECT)
                {
                    compositeDrawInfo.AddNodeType(nodeType, customIdentification.Name, customIdentification.IdentificationName);
                }
            }
            #endregion
        }
Пример #11
0
    public void AddNodeType(NODE_TYPE nodeType, string nodeName, int identification)
    {
        Node_Draw_Info_Item item = new Node_Draw_Info_Item(nodeType);

        item.SetName(nodeName);
        item.SetIdentification(identification);
        string name = string.Format("{0}/{1}", _nodeTypeName, nodeName);
        KeyValuePair <string, Node_Draw_Info_Item> kv = new KeyValuePair <string, Node_Draw_Info_Item>(name, item);

        _nodeArr.Add(kv);
    }
Пример #12
0
        public static ZNode CreateNode(NODE_TYPE nodeType, ZNodeTree nodeTree, Rect nodeRect, JSON js)
        {
            ZNode node = null;

            if (nodeType == NODE_TYPE.SEQUENCER)
            {
                node = new ZBTSequencer(nodeTree, nodeRect);
            }

            return(node);
        }
Пример #13
0
        private void CompositeNode(NodeValue nodeValue)
        {
            if (nodeValue.NodeType == (int)NODE_TYPE.CONDITION ||
                nodeValue.NodeType == (int)NODE_TYPE.ACTION)
            {
                return;
            }

            EditorGUILayout.BeginHorizontal(/*"box"*/);
            {
                string[]      nameArr  = EnumNames.GetEnumNames <NODE_TYPE>();
                List <string> nameList = new List <string>(nameArr);

                NODE_TYPE[] removeTypeArr = new NODE_TYPE[2] {
                    NODE_TYPE.ACTION, NODE_TYPE.CONDITION
                };
                for (int i = nameList.Count - 1; i >= 0; --i)
                {
                    for (int j = 0; j < removeTypeArr.Length; ++j)
                    {
                        NODE_TYPE type  = removeTypeArr[j];
                        int       value = EnumNames.GetEnumIndex <NODE_TYPE>(type);
                        string    name  = EnumNames.GetEnumName <NODE_TYPE>(value);
                        if (name.CompareTo(nameList[i]) == 0)
                        {
                            nameList.RemoveAt(i);
                            break;
                        }
                    }
                }
                nameArr = nameList.ToArray();
                int index = EnumNames.GetEnumIndex <NODE_TYPE>((NODE_TYPE)nodeValue.NodeType);
                if (index > nameArr.Length)
                {
                    index -= 2;//把 条件节点、行为节点,两个节点减掉
                }

                if ((NODE_TYPE)nodeValue.NodeType != NODE_TYPE.SUB_TREE)
                {
                    int result = EditorGUILayout.Popup(new GUIContent("改变节点类型"), index, nameArr);
                    if (result != index)
                    {
                        nodeValue.NodeType = (int)(EnumNames.GetEnum <NODE_TYPE>(result));
                        nodeValue.nodeName = EnumNames.GetEnumName <NODE_TYPE>(result);
                        nodeValue.function = NodeDescript.GetFunction((NODE_TYPE)nodeValue.NodeType);;

                        Debug.LogError(nodeValue.nodeName);
                    }
                }
            }
            EditorGUILayout.EndHorizontal();
        }
Пример #14
0
    public scr_Node(Vector3 _position, NODE_TYPE _type)
    {
        m_position = _position;

        m_up    = null;
        m_right = null;
        m_down  = null;
        m_left  = null;

        m_type     = _type;
        m_explored = false;
        return;
    }
Пример #15
0
    //////////////////////////////////////////////////////////////////////////
    // Public Methods                                                       //
    //////////////////////////////////////////////////////////////////////////

    public scr_Node()
    {
        m_position = Vector3.zero;

        m_up    = null;
        m_right = null;
        m_down  = null;
        m_left  = null;

        m_type     = NODE_TYPE.kNone;
        m_explored = false;
        return;
    }
Пример #16
0
    private void SetInfoList()
    {
        #region Node
        for (int i = 0; i < nodeList.Count; ++i)
        {
            string         name     = string.Format("{0}/{1}", "Add Node", typeNameArr[i]);
            Node_Draw_Info drawInfo = new Node_Draw_Info(name);
            NODE_TYPE[]    arr      = nodeList[i];
            for (NODE_TYPE nodeType = arr[0]; nodeType <= arr[1]; ++nodeType)
            {
                drawInfo.AddNodeType(nodeType);
                infoList.Add(drawInfo);
            }
        }

        {
            // 条件节点
            string         conditionName     = string.Format("{0}/{1}", "Add Node", "条件节点");
            Node_Draw_Info conditionDrawInfo = new Node_Draw_Info(conditionName);
            infoList.Add(conditionDrawInfo);

            // 行为节点
            string         actionName     = string.Format("{0}/{1}", "Add Node", "行为节点");
            Node_Draw_Info actionDrawInfo = new Node_Draw_Info(actionName);
            infoList.Add(actionDrawInfo);

            Dictionary <string, ICustomIdentification <NodeLeaf> > nodeDic = CustomNode.Instance.GetNodeDic();
            foreach (var kv in nodeDic)
            {
                ICustomIdentification <NodeLeaf> customIdentification = kv.Value;
                if (customIdentification.NodeType == NODE_TYPE.CONDITION)
                {
                    conditionDrawInfo.AddNodeType(NODE_TYPE.CONDITION, customIdentification.Name, customIdentification.IdentificationName);
                }
                else if (customIdentification.NodeType == NODE_TYPE.ACTION)
                {
                    actionDrawInfo.AddNodeType(NODE_TYPE.ACTION, customIdentification.Name, customIdentification.IdentificationName);
                }
            }
        }
        #endregion

        #region Sub_Tree
        {
            Node_Draw_Info drawInfo = new Node_Draw_Info("AddSubTree");
            drawInfo.AddNodeType(NODE_TYPE.SUB_TREE);
            infoList.Add(drawInfo);
        }
        #endregion
    }
Пример #17
0
        public Node(Physics.Vector2D aPosition, NodeIndex nodeIndex, NODE_TYPE nodeType)
        {
            type = nodeType;

            index         = new NodeIndex(nodeIndex);
            connections   = new List <Connection>();
            internalNodes = new List <Node>();


            lastDestinations = new List <NodeIndex>();
            lastOrigins      = new List <NodeIndex>();
            lastPaths        = new List <List <NodeIndex> >();

            position = aPosition;
        }
Пример #18
0
        public Node(int a_NodeNumber, Vector2 a_Position, NODE_TYPE a_Type = NODE_TYPE.WALKABLE)
        {
            nodeType       = a_Type;
            m_NodeNumber   = a_NodeNumber;
            m_Position     = a_Position;
            m_PreviousNode = null;
            m_GoalNode     = null;
            m_bVisited     = false;
            edges          = new List <Edge>();

            //red = walls
            //blue = water
            //black = unwalkable
            //white = walkable
            switch (a_Type)
            {
            case NODE_TYPE.WALKABLE:
                colour       = Color.White;
                m_Dimensions = new Vector2(10, 10);
                break;

            case NODE_TYPE.WALL:
                colour       = Color.Red;
                m_Dimensions = new Vector2(8, 8);
                break;

            case NODE_TYPE.WATER:
                colour       = Color.Blue;
                m_Dimensions = new Vector2(7, 7);
                break;

            case NODE_TYPE.NOT_WALKABLE:
                colour       = Color.Black;
                m_Dimensions = new Vector2(5, 5);
                break;

            default:
                colour       = Color.Gray;
                m_Dimensions = new Vector2(4, 4);
                break;
            }
        }
Пример #19
0
    void Start()
    {
        type = (NODE_TYPE)Random.Range(0, Enum.GetNames(typeof(NODE_TYPE)).Length);
        if (type == NODE_TYPE.FIGHT)
        {
            Button.onClick.AddListener(() => ChangeScene("SampleScene"));
        }
        if (type == NODE_TYPE.STORY)
        {
            Button.onClick.AddListener(() => ChangeScene("Story"));
        }
        if (type == NODE_TYPE.SHOP)
        {
            Button.onClick.AddListener(() => ChangeScene("FreeRoamScene"));
        }
        GameObject text = this.transform.Find("Text").gameObject;

        text.GetComponent <Text>().text = type.ToString();
        GetComponent <Image>().sprite   = sprites[(int)type];
    }
Пример #20
0
    private void AddNode(string nodeName, IDENTIFICATION identification, NODE_TYPE nodeType, Vector3 position, int subMachineId)
    {
        SkillHsmConfigNodeData newNodeValue = new SkillHsmConfigNodeData();

        newNodeValue.Id = GetNewstateId();

        newNodeValue.NodeName       = nodeName;
        newNodeValue.Identification = (int)identification;
        newNodeValue.NodeType       = (int)nodeType;

        Rect rect = new Rect(position.x, position.y, 150, 50);

        newNodeValue.Position = RectTExtension.RectToRectT(rect);

        if (subMachineId >= 0)
        {
            newNodeValue.ParentId = subMachineId;

            SkillHsmConfigNodeData subMachineNode = GetNode(subMachineId);
            if (subMachineNode == null || subMachineNode.NodeType != (int)NODE_TYPE.SUB_STATE_MACHINE)
            {
                Debug.LogError("Node is not SubMachine:" + subMachineId);
                return;
            }

            subMachineNode.ChildIdList.Add(newNodeValue.Id);
        }

        NodeList.Add(newNodeValue);

        if (_HSMTreeData.DefaultStateId < 0)
        {
            SetDefaultState(newNodeValue);
        }

        if (nodeType == NODE_TYPE.SUB_STATE_MACHINE)
        {
            AddNode("Entry", IDENTIFICATION.STATE_ENTRY, NODE_TYPE.ENTRY, new Vector3(900, 150, 0), newNodeValue.Id);
            AddNode("Exit", IDENTIFICATION.STATE_EXIT, NODE_TYPE.EXIT, new Vector3(900, 550, 0), newNodeValue.Id);
        }
    }
Пример #21
0
        private void MakeCircle(DeBruijnNode startNode, DeBruijnGraph graph)
        {
            CircularLoop = true;
            byte[] v = startNode.GetOriginalSymbols(graph.KmerLength);
            Console.WriteLine((new Sequence(DnaAlphabet.Instance, v)).ToString());
            ConstituentNodes.Add(startNode);
            startNode.IsVisited = true;
            Dictionary <DeBruijnNode, bool> nextNodes;
            bool goRight = true;

            nextNodes = startNode.GetRightExtensionNodesWithOrientation();
            var          nextSet = nextNodes.First();
            DeBruijnNode next    = nextSet.Key;

            while (next != startNode)
            {
                next.IsVisited = true;
                ConstituentNodes.Add(next);
                bool      sameOrientation = nextSet.Value;
                NODE_TYPE nextType        = ClassifyNode(next);
                //what direction do we get the node following the next one from? (Note path out determined by path in, so don't need to look at next node to get side of the one after).
                goRight = (!goRight) ^ sameOrientation;
                if (nextType == NODE_TYPE.LINK_IN_CHAIN)
                {
                    //NOTE: four possibilities condense in to 2 possible sides so written with ^ operator
                    nextNodes = goRight ? next.GetRightExtensionNodesWithOrientation() : next.GetLeftExtensionNodesWithOrientation();
                    //now how to determine what base to get? This only depends on relationship of current node to next node
                    //in all cases we either grab the RC of the first base or the last base, and which to grab is determined by incoming node
                    byte nextSymbol = GetNextSymbol(next, graph.KmerLength, !goRight);
                    contigSequence.Add(nextSymbol);
                }
                else
                {
                    throw new Exception("Non circular path being treated like one");
                }
                nextSet = nextNodes.First();
                next    = nextSet.Key;
            }
            Sequence = (new Sequence((IAlphabet)NoGapDnaAlphabet.Instance, contigSequence.ToArray())).ConvertToString(0, contigSequence.Count);
        }
Пример #22
0
    private void SetInfoList()
    {
        for (int i = 0; i < nodeList.Count; ++i)
        {
            Node_Draw_Info drawInfo = new Node_Draw_Info(typeNameArr[i]);
            NODE_TYPE[]    arr      = nodeList[i];
            for (NODE_TYPE nodeType = arr[0]; nodeType <= arr[1]; ++nodeType)
            {
                drawInfo.AddNodeType(nodeType);
                infoList.Add(drawInfo);
            }
        }


        {
            // 条件节点
            Node_Draw_Info conditionDrawInfo = new Node_Draw_Info("条件节点");
            infoList.Add(conditionDrawInfo);

            // 行为节点
            Node_Draw_Info actionDrawInfo = new Node_Draw_Info("行为节点");
            infoList.Add(actionDrawInfo);

            List <CustomIdentification> nodeList = CustomNode.Instance.GetNodeList();
            for (int i = 0; i < nodeList.Count; ++i)
            {
                CustomIdentification customIdentification = nodeList[i];
                if (customIdentification.NodeType == NODE_TYPE.CONDITION)
                {
                    conditionDrawInfo.AddNodeType(NODE_TYPE.CONDITION, customIdentification.Name, (int)customIdentification.Identification);
                }
                else if (customIdentification.NodeType == NODE_TYPE.ACTION)
                {
                    actionDrawInfo.AddNodeType(NODE_TYPE.ACTION, customIdentification.Name, (int)customIdentification.Identification);
                }
            }
        }
    }
        public void SetValue(string value)
        {
            //(04.07.2006 10:32)
            //Check for text first.
            if (IsText(value))
            {
                this.m_value = GetText(value);
                this.m_type = NODE_TYPE.TEXT;
                return;
            }
            //Check for operators first.
            OperatorMatch opMatch = FindOperators(value, m_operatorManager);
            if (opMatch != null)
            {
                m_type = NODE_TYPE.OPERATOR;
                string leftParam = value.Substring(0, opMatch.StartIndex);
                string rightParam = value.Substring(opMatch.StartIndex + opMatch.Length);
                if (leftParam != "")
                    m_subNodes = new ExpressionTreeNode[]{new ExpressionTreeNode(leftParam, m_column, m_operatorManager),
                        new ExpressionTreeNode(rightParam, m_column, m_operatorManager)};
                else
                    m_subNodes = new ExpressionTreeNode[]{new ExpressionTreeNode(rightParam, m_column, m_operatorManager)};
                m_value = opMatch.ExpressionOperator.FunctionName;
            }
            else if (value.IndexOf("(") != -1)
            {
                int paranStart = value.IndexOf('(');
                string functionName = value.Substring(0, paranStart);
                if (value.Length - paranStart - 2 < 0)
                {
                    throw new ExpressionException("Missing ')'", m_column, value.Length);
                }
                string param = value.Substring(paranStart + 1, value.Length - paranStart - 2);
                if (functionName == "")
                {
                    m_column += 1;
                    SetValue(param);
                    return;
                }
                if (param != "")
                {
                    ArrayList @params = new ArrayList();
                    int col = m_column + paranStart + 1;
                    int depth = 0;
                    string par = "";
                    //(27.07.2006 16:24)
                    //Detects whether we are inside a text or not.
                    bool insideText = false;
                    for (int i = 0; i <= param.Length - 1; i++)
                    {
                        char c = param[i];
                        if (c == '(')
                        {
                            depth += 1;
                        }
                        else if (c == ')')
                        {
                            depth -= 1;
                        }
                        else if (c == '"')
                        {
                            insideText = !insideText;
                        }
                        if (depth == 0 && c == ';' && !insideText)
                        {
                            @params.Add(par);
                            par = "";
                        }
                        else
                        {
                            par += c;
                        }
                    }
                    if (par != "")
                    {
                        @params.Add(par);
                    }

                    m_subNodes = new ExpressionTreeNode[@params.Count];
                    for (int i = 0; i < @params.Count; i++)
                    {
                        m_subNodes[i] = new ExpressionTreeNode((string)@params[i], col, m_operatorManager);
                        col += ((string)@params[i]).Length + 1;
                    }
                    // (23.02.2007 15:15)
                    if (value.IndexOf(')') == -1 || depth > 0)
                        throw new ExpressionException("Missing ')'", m_column, value.Length);
                    else if (depth < 0)
                        throw new ExpressionException("One ')' to much", m_column, value.Length);
                }
                else
                {
                    m_subNodes = new ExpressionTreeNode[] {};
                }
                m_value = functionName;
                m_type = NODE_TYPE.FUNCTION;
            }
            else
            {
                //Number or post data.
                m_value = value.Trim();
                if (IsNumeric(m_value))
                {
                    m_type = NODE_TYPE.NUMBER;
                    m_value = float.Parse((string)m_value);
                }
                else
                {
                    m_type = NODE_TYPE.VARIABLE;
                }
            }
        }
Пример #24
0
        /// <summary>
        /// Creates a scene node from a stream
        /// </summary>
        /// <param name="_Owner"></param>
        /// <param name="_Parent"></param>
        /// <param name="_Reader"></param>
        internal Node(Scene _Owner, Node _Parent, System.IO.BinaryReader _Reader)
        {
            m_Owner = _Owner;

//			m_NodeType = _Reader.ReadInt32();	// Don't read back the node type as it has already been consumed by the parent
            m_ID = _Reader.ReadInt32();
            m_Owner.RegisterNodeID(this);
            m_Name = _Reader.ReadString();

            m_Parent = _Parent;
            if (_Parent != null)
            {
                m_Parent.AddChild(this);
            }

            // Read the matrix
            m_Local2Parent.m[0, 0] = _Reader.ReadSingle();
            m_Local2Parent.m[0, 1] = _Reader.ReadSingle();
            m_Local2Parent.m[0, 2] = _Reader.ReadSingle();
            m_Local2Parent.m[0, 3] = _Reader.ReadSingle();
            m_Local2Parent.m[1, 0] = _Reader.ReadSingle();
            m_Local2Parent.m[1, 1] = _Reader.ReadSingle();
            m_Local2Parent.m[1, 2] = _Reader.ReadSingle();
            m_Local2Parent.m[1, 3] = _Reader.ReadSingle();
            m_Local2Parent.m[2, 0] = _Reader.ReadSingle();
            m_Local2Parent.m[2, 1] = _Reader.ReadSingle();
            m_Local2Parent.m[2, 2] = _Reader.ReadSingle();
            m_Local2Parent.m[2, 3] = _Reader.ReadSingle();
            m_Local2Parent.m[3, 0] = _Reader.ReadSingle();
            m_Local2Parent.m[3, 1] = _Reader.ReadSingle();
            m_Local2Parent.m[3, 2] = _Reader.ReadSingle();
            m_Local2Parent.m[3, 3] = _Reader.ReadSingle();

            // Read specific data
            LoadSpecific(_Reader);

            // Read children
            int ChildrenCount = _Reader.ReadInt32();

            for (int ChildIndex = 0; ChildIndex < ChildrenCount; ChildIndex++)
            {
                NODE_TYPE ChildType = (NODE_TYPE)_Reader.ReadByte();
                switch (ChildType)
                {
                case NODE_TYPE.NODE:
                    new Node(_Owner, this, _Reader);
                    break;

                case NODE_TYPE.MESH:
                    new Mesh(_Owner, this, _Reader);
                    break;

                case NODE_TYPE.LIGHT:
                    new Light(_Owner, this, _Reader);
                    break;

                case NODE_TYPE.CAMERA:
                    new Camera(_Owner, this, _Reader);
                    break;
                }
            }
        }
Пример #25
0
 public NodeDecorator(NODE_TYPE nodeType) : base(nodeType)
 {
 }
Пример #26
0
 public NodeComposite(NODE_TYPE nodeType) : base()
 {
     SetNodeType(nodeType);
 }
Пример #27
0
 public Node_Draw_Info_Item(NODE_TYPE nodeType)
 {
     _nodeType = nodeType;
 }
Пример #28
0
        public MetaNode(DeBruijnNode startNode, DeBruijnGraph graph)
        {
            this.NodeNumber = GraphGenerator.NodeCount++;
            KmerLength      = graph.KmerLength;
            if (startNode.IsVisited)
            {
                throw new Exception("If a node has been visited it should not form a metanode, suggests an infinite recursion problem");
            }
            NODE_TYPE type = ClassifyNode(startNode);

            startNode.IsVisited = true;
            //Either of these become their own thing
            if (type == NODE_TYPE.NEXUS || type == NODE_TYPE.ISLAND || type == NODE_TYPE.END_LOOPS_ON_ITSELF)
            {
                ConstituentNodes.Add(startNode);
                contigSequence = new List <byte>(graph.GetNodeSequence(startNode));
                Sequence       = (new Sequence((IAlphabet)NoGapDnaAlphabet.Instance, contigSequence.ToArray())).ConvertToString(0, contigSequence.Count);
            }
            else if (type == NODE_TYPE.LINK_IN_CHAIN)
            {
                contigSequence = new List <byte>(graph.GetNodeSequence(startNode));
                if (!VerifyNotCircular(startNode))
                {
                    MakeCircle(startNode, graph);
                    //throw new Exception("Non circular visualizations not currently supported");
                }
                else
                {
                    //go right first
                    contigSequence = new List <byte>(graph.GetNodeSequence(startNode));
                    //var nextNodes = ExtendChain(startNode, true, graph);
                    ExtendChain(startNode, true, graph);
                    //copy the right information and clear it out
                    var tmpRightSeq = contigSequence.ToArray();
                    //skip the first node
                    var tmpRightNodes = ConstituentNodes.Skip(1).ToArray();
                    ConstituentNodes.Clear();
                    contigSequence.Clear();
                    //now go left
                    ExtendChain(startNode, false, graph);
                    //now lets combine
                    ConstituentNodes.Reverse();
                    ConstituentNodes.AddRange(tmpRightNodes);
                    var tmpSequence = new Sequence(DnaAlphabet.Instance, contigSequence.ToArray());
                    tmpSequence = new Sequence(tmpSequence.GetReverseComplementedSequence());
                    string LeftSequence = "";
                    if (tmpSequence.Count > 0)
                    {
                        LeftSequence = tmpSequence.ConvertToString(0, tmpSequence.Count);
                    }
                    tmpSequence    = new Sequence(DnaAlphabet.Instance, tmpRightSeq);
                    Sequence       = LeftSequence + tmpSequence.ConvertToString(0, (tmpSequence.Count));
                    contigSequence = new Sequence(DnaAlphabet.Instance, Sequence).ToList();
                }
            }
            else if (type == NODE_TYPE.GO_LEFT)
            {
                contigSequence = new List <byte>(graph.GetNodeSequence(startNode).GetReverseComplementedSequence());
                //var nextNodes = ExtendChain(startNode, false, graph);
                ExtendChain(startNode, false, graph);
                var tmpSequence = new Sequence(DnaAlphabet.Instance, contigSequence.ToArray());
                //somewhat confusing - originally built the RC of sequence, so RCing again to get correct orientation for
                //neighbors

                tmpSequence    = new Sequence(tmpSequence.GetReverseComplementedSequence());
                contigSequence = tmpSequence.ToList();
                Sequence       = tmpSequence.ConvertToString(0, tmpSequence.Count);
                //flip it so nodes and sequence are in order
                ConstituentNodes.Reverse();
            }
            else if (type == NODE_TYPE.GO_RIGHT)
            {
                contigSequence = new List <byte>(graph.GetNodeSequence(startNode));
                //var nextNodes = ExtendChain(startNode, true, graph);
                ExtendChain(startNode, true, graph);
                var tmpSequence = new Sequence(DnaAlphabet.Instance, contigSequence.ToArray());
                Sequence = tmpSequence.ConvertToString(0, tmpSequence.Count);
            }

            Cement();
        }
Пример #29
0
 public void SetNodeType(NODE_TYPE nodeType)
 {
     m_nodeType = nodeType;
 }
Пример #30
0
 public NodeDecoratorReturnConst(NODE_TYPE nodeType) : base(nodeType)
 {
 }
Пример #31
0
 public NodeLeaf(NODE_TYPE nodeType) : base(nodeType)
 {
 }