Exemplo n.º 1
0
    void loadNodes(STSerializedNode sNode)
    {
        mRotor.transform.rotation = new Quaternion(sNode.rotation.X, sNode.rotation.Y, sNode.rotation.Z, sNode.rotation.W);
        transform.localPosition   = new Vector3(sNode.position.X, sNode.position.Y, sNode.position.Z);

        if (sNode.node_type == 1)
        {
            this.changeNodeType();
        }
        if (sNode.children == null)
        {
            return;
        }

        foreach (STSerializedNode nodeChild in sNode.children)
        {
            STRootNode root = STLevel.GetRootNode();
            STNode     node = Instantiate(root.NodePref) as STNode;
            if (node != null)
            {
                node.transform.parent = mRotor.transform;
                node.mParent          = this;
                mRotor.mChilds.Add(node);
                node.LoadNodes(nodeChild);
            }
        }
    }
Exemplo n.º 2
0
 public void LoadNodes(STSerializedNode sNode)
 {
     this.loadNodes(sNode);
     //	SaveChildPositions ();
     this.UpdateLinkPosition(this.transform.position);
     //	LoadChildPositions ();
 }
Exemplo n.º 3
0
    public STSerializedNode GetSerializedObject(STSerializedNode sObject)
    {
        sObject.rotation   = new STSerializableQuaternion();
        sObject.rotation.X = mRotor.transform.rotation.x;
        sObject.rotation.Y = mRotor.transform.rotation.y;
        sObject.rotation.Z = mRotor.transform.rotation.z;
        sObject.rotation.W = mRotor.transform.rotation.w;

        sObject.position   = new STSerializableVector3();
        sObject.position.X = transform.localPosition.x;
        sObject.position.Y = transform.localPosition.y;
        sObject.position.Z = transform.localPosition.z;

        if (NodeType == NODE_T.SIMPLE)
        {
            sObject.node_type = 0;
        }

        else if (NodeType == NODE_T.COLLECTABLE)
        {
            sObject.node_type = 1;
        }

        sObject.children = new STSerializedNode[mRotor.mChilds.Count];
        int i = 0;

        foreach (STNode childNode in mRotor.mChilds)
        {
            sObject.children [i] = new STSerializedNode();
            sObject.children [i] = childNode.GetSerializedObject(sObject.children [i]);

            Debug.Log("SER CHILD" + sObject.children [i]);

            i++;
        }

        return(sObject);
    }