Exemplo n.º 1
0
    /// <summary>
    /// 初始化默认配置
    /// </summary>
    public void InitDefaultInfo()
    {
        TerrainMakerDefine.DefaultTerrainInfo defaultTerrainInfo = m_Root.Define.CurrentDefaultTerrainInfo;

        m_ResourcePathInfo   = defaultTerrainInfo.ResourcePathInfo.Clone() as ResourcePathInfo;
        m_GameObjectPathInfo = defaultTerrainInfo.GameObjectPathInfo.Clone() as GameObjectPathInfo;
        m_BuildingInfo       = defaultTerrainInfo.BuildingInfo.Clone() as BuildingInfo;
        m_GamePlayInfo       = defaultTerrainInfo.GamePlayInfo.Clone() as GamePlayInfo;
        m_TweenInfo          = defaultTerrainInfo.TweenInfo.Clone() as TweenInfo;
        m_ColorInfo          = defaultTerrainInfo.ColorInfo.Clone() as ColorInfo;
        m_SceneArtInfo       = defaultTerrainInfo.SceneArtInfo.Clone() as SceneArtInfo;

        LogHelper.Trace?.Log("TerrainMakerTool", "InitDefaultInfo.",
                             LogHelper.Object2String(m_ResourcePathInfo),
                             LogHelper.Object2String(m_GameObjectPathInfo),
                             LogHelper.Object2String(m_BuildingInfo),
                             LogHelper.Object2String(m_GamePlayInfo),
                             LogHelper.Object2String(m_TweenInfo),
                             LogHelper.Object2String(m_ColorInfo),
                             LogHelper.Object2String(m_SceneArtInfo)
                             );
    }
Exemplo n.º 2
0
    /// <summary>
    /// 创建默认配置
    /// </summary>
    private void __CreateDefaultTerrainInfo()
    {
        //资源路径
        if (m_CurrentDefaultTerrainInfo.ResourcePathInfo == null)
        {
            ResourcePathInfo resourcePathInfo = new ResourcePathInfo();

            resourcePathInfo.TerrainPath      = "Prefab/Terrain";
            resourcePathInfo.TerrainPiecePath = "Prefab/TerrainPiece";

            m_CurrentDefaultTerrainInfo.ResourcePathInfo = resourcePathInfo;
        }

        if (m_CurrentDefaultTerrainInfo.GameObjectPathInfo == null)
        {
            GameObjectPathInfo gameObjectPathInfo = new GameObjectPathInfo();

            gameObjectPathInfo.PieceMaterialPath = "Cube";
            gameObjectPathInfo.SideRootPath      = "Side";
            gameObjectPathInfo.SideMaterialPath  = "Tag";
            gameObjectPathInfo.DownPath          = "Down";
            gameObjectPathInfo.UpPath            = "Up";
            gameObjectPathInfo.BuildingRootPath  = "Building";

            m_CurrentDefaultTerrainInfo.GameObjectPathInfo = gameObjectPathInfo;
        }


        //建筑
        if (m_CurrentDefaultTerrainInfo.BuildingInfo == null)
        {
            BuildingInfo buildingInfo = new BuildingInfo();
            //地块大小
            buildingInfo.TerrainSize   = new Vector3();
            buildingInfo.TerrainSize.x = 4;
            buildingInfo.TerrainSize.y = 1;
            buildingInfo.TerrainSize.z = 4;

            //间隔
            buildingInfo.IntervalSize   = new Vector3();
            buildingInfo.IntervalSize.x = 1;
            buildingInfo.IntervalSize.y = 1.6f;
            buildingInfo.IntervalSize.z = 1;

            //地块方向块偏移值 (从中心点到边缘的方向)
            buildingInfo.SideShiftingValue = 0.35f;

            m_CurrentDefaultTerrainInfo.BuildingInfo = buildingInfo;
        }

        //玩法
        if (m_CurrentDefaultTerrainInfo.GamePlayInfo == null)
        {
            GamePlayInfo gamePlayInfo = new GamePlayInfo();

            gamePlayInfo.BirthLogicPosition  = Vector3.zero;
            gamePlayInfo.HasEndLogicPosition = false;
            gamePlayInfo.EndLoigcPosition    = Vector3.zero;

            m_CurrentDefaultTerrainInfo.GamePlayInfo = gamePlayInfo;
        }

        //动画
        if (m_CurrentDefaultTerrainInfo.TweenInfo == null)
        {
            TweenInfo tweenInfo = new TweenInfo();

            tweenInfo.Originate = 8;
            tweenInfo.MoveSpeed = 1.8f;

            m_CurrentDefaultTerrainInfo.TweenInfo = tweenInfo;
        }

        //颜色
        if (m_CurrentDefaultTerrainInfo.ColorInfo == null)
        {
            ColorInfo colorInfo = new ColorInfo();

            colorInfo.Floor_Current = new Color(1, 1, 1, 1);
            colorInfo.Floor_Other   = new Color(0.8f, 0.8f, 0.8f, 0.29f);

            colorInfo.Piece_Current      = new Color(1, 1, 1, 1);
            colorInfo.Piece_ArriveAround = new Color(0.75f, 0.78f, 0.79f, 1);
            colorInfo.Piece_Other        = new Color(0.75f, 0.78f, 0.79f, 1);
            colorInfo.Piece_End          = new Color(0.82f, 0.3f, 0.3f, 1);

            colorInfo.Side_Current = new Color(0.36f, 0.33f, 0.3f, 1);
            colorInfo.Side_Other   = new Color(0.37f, 0.38f, 0.35f, 1);

            m_CurrentDefaultTerrainInfo.ColorInfo = colorInfo;
        }

        //场景表现
        if (m_CurrentDefaultTerrainInfo.SceneArtInfo == null)
        {
            SceneArtInfo sceneArtInfo = new SceneArtInfo();

            //首层3200 到3000可以容纳40层,应该是满足扩展的。
            sceneArtInfo.FirstFloorShaderLayer = 3200;

            //每个层预留5个shader层级单位
            //  0 = 扩展层
            // -1 = player
            // -2 = building
            // -3 = pieceSide
            // -4 = piece
            sceneArtInfo.FloorShaderLayerInterval = 5;

            m_CurrentDefaultTerrainInfo.SceneArtInfo = sceneArtInfo;
        }
    }