示例#1
0
    //public Dictionary<string, GameObject> kids;
    // a Scene where you use vive controllers to press against a force would be cool

    void Awake()
    {
        shapeMenu.gameObject.SetActive(false);
        mom      = new DnParent();
        mom.kids = new Dictionary <string, GameObject>();
        //kids = new Dictionary<string, GameObject>();
        sp = spaceSphere.GetComponent <SpaceSphereScript>();
    }
示例#2
0
    public static void SaveData(DnParent mama)
    {
        BinaryFormatter formatter = new BinaryFormatter();
        string          path      = Application.persistentDataPath + "/roll.save";
        FileStream      stream    = new FileStream(path, FileMode.Create);

        DnData data = new DnData(mama);

        formatter.Serialize(stream, data);
        stream.Close();
    }
示例#3
0
    public DnData(DnParent mama)
    {
        int kids = mama.transform.childCount;

        GameObject[] children  = new GameObject[kids];
        string[]     babyNames = new string[kids];
        float[][]    babyPos   = new float[kids][];
        for (int i = 0; i < kids; i++)
        {
            babyNames[i] = children[i].name;
            // I need to set children to an instance of an existing prefab object
            babyPos[i][0] = children[i].transform.position.x;
            babyPos[i][1] = children[i].transform.position.y;
            babyPos[i][2] = children[i].transform.position.z;
        }

        name = mama.name;

        position    = new float[3];
        position[0] = mama.transform.position.x;
        position[1] = mama.transform.position.y;
        position[2] = mama.transform.position.z;
    }