Esempio n. 1
0
        public SavedSceneObject GetSerializableObject()
        {
            var serializableObject = new SavedSceneObject();

            serializableObject.ObjectID  = Id;
            serializableObject.ModelPath = model != null ? model.modelPath : "";
            serializableObject.Material  = material as SimpleMaterial;
            serializableObject.Transform = transform.GetSerializableTransform();

            serializableObject.AnimationComponent = animationComponent;
            serializableObject.Components         = new List <SceneObjectComponent>(components);

            return(serializableObject);
        }
Esempio n. 2
0
        public SceneObject(SavedSceneObject savedSceneObject)
        {
            Id = savedSceneObject.ObjectID;

            if (string.IsNullOrEmpty(savedSceneObject.ModelPath) == false)
            {
                model = new ModelLoader(SceneManager.currentRenderer.device).LoadRelative(savedSceneObject.ModelPath);
            }
            material  = savedSceneObject.Material;
            transform = new Transform(savedSceneObject.Transform);

            animationComponent = savedSceneObject.AnimationComponent;
            if (animationComponent != null)
            {
                AddComponent(animationComponent);
            }

            foreach (var component in savedSceneObject.Components)
            {
                AddComponent(component);
            }
        }