예제 #1
0
        private static EntityDocument MakeEntityDocument(Entity entity)
        {
            EntityDocument entityDocument = new EntityDocument()
            {
                id         = entity.ID,
                name       = entity.Name,
                children   = MakeEntityDocuments(entity.Children),
                components = MakeComponentDocuments(entity.Components)
            };

            return(entityDocument);
        }
예제 #2
0
        private static Entity ParseEntity(EntityDocument entityDocument, Graph graph)
        {
            Entity entity = new Entity(entityDocument.id, entityDocument.name, graph);

            if (entityDocument.components != null)
            {
                foreach (var component in entityDocument.components)
                {
                    entity.Components.Add(ParseComponent(component));
                }
            }

            entityDocument.children?.ForEach(childEntityDoc => entity.AddChild(ParseEntity(childEntityDoc, graph)));

            return(entity);
        }