예제 #1
0
        /// <summary>
        /// 生成默认场景配置
        /// </summary>
        SceneSettings GenDefaultSceneSettings()
        {
            var settings = ScriptableObject.CreateInstance <SceneSettings>();

            settings.trees = new List <SceneTreeSettings>();
            // 碰撞
            var tree = new SceneTreeSettings();

            tree.name              = "collider";
            tree.splitType         = SceneTreeSplitType.Quad;
            tree.objType           = SceneTreeObjType.Collider;
            tree.Index             = SceneTreeIndex.Collider;
            tree.maxDepth          = 6;
            tree.viewDistance      = 50f;
            tree.maxItemBoundsSize = 1.0e+7f;
            settings.trees.Add(tree);

            // 草 ,去掉草,草通过特殊的方式去管理和绘制
            tree                   = new SceneTreeSettings();
            tree.name              = "grass";
            tree.splitType         = SceneTreeSplitType.Quad;
            tree.objType           = SceneTreeObjType.Renderer;
            tree.Index             = SceneTreeIndex.Grass;
            tree.maxDepth          = 6;
            tree.viewDistance      = 25f;
            tree.maxItemBoundsSize = 1.0e+7f;
            settings.trees.Add(tree);

            // 近景
            tree                   = new SceneTreeSettings();
            tree.name              = "near";
            tree.splitType         = SceneTreeSplitType.Quad;
            tree.objType           = SceneTreeObjType.Renderer;
            tree.Index             = SceneTreeIndex.Near;
            tree.maxDepth          = 6;
            tree.viewDistance      = 25f;
            tree.maxItemBoundsSize = 10.0f;
            settings.trees.Add(tree);

            // 中景
            tree                   = new SceneTreeSettings();
            tree.name              = "mid";
            tree.splitType         = SceneTreeSplitType.Quad;
            tree.objType           = SceneTreeObjType.Renderer;
            tree.Index             = SceneTreeIndex.Mid;
            tree.maxDepth          = 6;
            tree.viewDistance      = 150f;
            tree.maxItemBoundsSize = 50.0f;
            settings.trees.Add(tree);

            // 远景
            tree                   = new SceneTreeSettings();
            tree.name              = "far";
            tree.splitType         = SceneTreeSplitType.Quad;
            tree.objType           = SceneTreeObjType.Renderer;
            tree.Index             = SceneTreeIndex.Far;
            tree.maxDepth          = 6;
            tree.viewDistance      = 250f;
            tree.maxItemBoundsSize = 1.0e+7f;
            settings.trees.Add(tree);

            return(settings);
        }
예제 #2
0
 /// <summary>
 /// 构造
 /// </summary>
 SceneTree(SceneTreeSettings settings)
 {
     _settings = settings;
 }