コード例 #1
0
        /// <summary>
        /// 打开编辑器的场景
        /// </summary>
        public void OpenEditorScene(BlockObjectData bod)
        {
            this.data = bod;
            EditorSceneManager.SaveOpenScenes();
            var path = EditorSceneManager.GetActiveScene().path;

            if (!string.IsNullOrEmpty(path))
            {
                mainScenePath = path;
            }
            EditorSceneManager.NewScene(NewSceneSetup.DefaultGameObjects, NewSceneMode.Single);
            go = new GameObject("Block Object");
            var filter = go.AddComponent <MeshFilter>();

            go.AddComponent <MeshRenderer>();
            var bo = go.AddComponent <BlockObject>();

            filter.mesh = bo.mesh;
            bo.data     = this.data;
            Selection.activeGameObject    = go;
            SceneView.onSceneGUIDelegate += this.OnSceneViewGUI;
            isOpen = true;
        }
コード例 #2
0
 /// <summary>
 /// 创建地图块
 /// </summary>
 /// <param name="data">断面数据</param>
 public void SetBlocks(BlockObjectData data)
 {
     this.blocks = data.GetBlocks();
     isDirty     = true;
 }