private void OnOpenButtonClick(string dataBaseOpenPath) { SceneDescriptor sceneDescriptor = SceneDescriptorsHelper.LoadFromFile(dataBaseOpenPath); if (!String.IsNullOrEmpty(sceneDescriptor.sceneName)) { scene = new GameObject(sceneDescriptor.sceneName).transform; } else { scene = new GameObject("Scene").transform; } scene.position = new Vector3(0, 0, 0); SceneComponent sceneComponent = scene.gameObject.AddComponent <SceneComponent>(); sceneComponent.SceneSize = sceneDescriptor.sceneSize; var environmentFolder = new GameObject(SceneDescriptorsHelper.EnvironmentFolderName).transform; environmentFolder.transform.SetParent(scene); SpritesCache cache = new SpritesCache(); SceneDescriptorsHelper.CreateInstances(sceneDescriptor.imagesEnvironment, environmentFolder, cache); SceneDescriptorsHelper.CreateInstances(sceneDescriptor.items, scene, cache); }
public BuildResult Build(string dataBasePath) { SceneDescriptor sceneDescriptor = SceneDescriptorsHelper.LoadFromFile(dataBasePath); return(Build(sceneDescriptor)); }