Esempio n. 1
0
    public void LoadNet(STSerializedNet net)
    {
        NetworkNodesDistance = net.NetworkNodesDistance;

        if (net.NetworkType == 0)
        {
            NetworkType = NET_T.SIMPLE;
        }
        else if (net.NetworkType == 1)
        {
            NetworkType = NET_T.RADIAL;
        }
        else if (net.NetworkType == 2)
        {
            NetworkType = NET_T.CIRCLE;
        }


        List <Vector3> activePointsList = new List <Vector3> ();



        if (net.activeNodePos != null)
        {
            foreach (STSerializableVector3 point in net.activeNodePos)
            {
                activePointsList.Add(new Vector3(point.X, point.Y, point.Z));
            }
        }

        this.Reset();
        this.Start();
        iNet.SetActiveNodes(activePointsList);
    }
Esempio n. 2
0
    public STSerializedNet GetSerializedObject()
    {
        STSerializedNet sNet = new STSerializedNet();

        sNet.NetworkNodesDistance = NetworkNodesDistance;

        if (NetworkType == NET_T.SIMPLE)
        {
            sNet.NetworkType = 0;
        }
        else if (NetworkType == NET_T.RADIAL)
        {
            sNet.NetworkType = 1;
        }
        else if (NetworkType == NET_T.CIRCLE)
        {
            sNet.NetworkType = 2;
        }


        List <Vector3> activePointsList = iNet.GetActiveNodesPositions();



        int listLen = activePointsList.Count;

        sNet.activeNodePos = new STSerializableVector3 [listLen];
        //sObject.children = new STSerializedNode[mRotor.mChilds.Count];


        int i = 0;

        Debug.Log("NET POINTS" + activePointsList);
        Debug.Log("OUT SLEVEL NET POS - " + sNet.activeNodePos);
        foreach (Vector3 point in activePointsList)
        {
            //sNet.activeNodePos.Add (new STSerializableVector3 (point));
            Debug.Log("ADDNODE");
            sNet.activeNodePos [i]   = new STSerializableVector3();
            sNet.activeNodePos [i].X = point.x;
            sNet.activeNodePos [i].Y = point.y;
            sNet.activeNodePos [i].Z = point.z;
            i++;
        }


        return(sNet);
    }