示例#1
0
 /// <summary>
 /// Constructs a new WWObject data from a JSON blobl, presumably from a file.
 /// </summary>
 /// <param name="b"> the JSON blob</param>
 public WWObjectData(WWObjectJSONBlob b)
 {
     id          = b.id;
     wwTransform = new WWTransform(b.wwTransform);
     resourceTag = b.resourceTag;
     // Note parent and children relationships are re-linked in the SceneGraphController
     // during the Load Operation
     parent   = null;
     children = new List <WWObjectData>();
 }
        /// <summary>
        /// Get all WWObjects in the scene and create a list of Serializable JSON Blobs.
        /// </summary>
        /// <returns>a list of WWObjectJSONBlobs for all objects maintained by the data structure.</returns>
        public List <WWObjectJSONBlob> GetObjectsAsJSONBlobs()
        {
            var objectstoSave = new List <WWObjectJSONBlob>();

            Debug.Log(GetCount());
            foreach (KeyValuePair <Guid, WWObject> guidToObject in objects)
            {
                var blob = new WWObjectJSONBlob(guidToObject.Value.objectData);
                objectstoSave.Add(blob);
            }
            return(objectstoSave);
        }