コード例 #1
0
        public override void PostLoad()
        {
            placingDraggableDimensions = 2;
            LongEventHandler.ExecuteWhenFinished(delegate
            {
                Shader shader = null;
                switch (edgeType)
                {
                case TerrainEdgeType.Hard:
                    shader = ShaderDatabase.TerrainHard;
                    break;

                case TerrainEdgeType.Fade:
                    shader = ShaderDatabase.TerrainFade;
                    break;

                case TerrainEdgeType.FadeRough:
                    shader = ShaderDatabase.TerrainFadeRough;
                    break;

                case TerrainEdgeType.Water:
                    shader = ShaderDatabase.TerrainWater;
                    break;
                }
                graphic = GraphicDatabase.Get <Graphic_Terrain>(texturePath, shader, Vector2.one, color, 2000 + renderPrecedence);
                if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater)
                {
                    graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
                }
                if (!waterDepthShader.NullOrEmpty())
                {
                    waterDepthMaterial             = MaterialAllocator.Create(ShaderDatabase.LoadShader(waterDepthShader));
                    waterDepthMaterial.renderQueue = 2000 + renderPrecedence;
                    waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
                    if (waterDepthShaderParameters != null)
                    {
                        for (int j = 0; j < waterDepthShaderParameters.Count; j++)
                        {
                            waterDepthShaderParameters[j].Apply(waterDepthMaterial);
                        }
                    }
                }
            });
            if (tools != null)
            {
                for (int i = 0; i < tools.Count; i++)
                {
                    tools[i].id = i.ToString();
                }
            }
            base.PostLoad();
        }
コード例 #2
0
ファイル: TerrainDef.cs プロジェクト: sachdevs/RW-Decompile
        public override void PostLoad()
        {
            this.placingDraggableDimensions = 2;
            LongEventHandler.ExecuteWhenFinished(delegate
            {
                Shader shader = null;
                switch (this.edgeType)
                {
                case TerrainDef.TerrainEdgeType.Hard:
                    shader = ShaderDatabase.TerrainHard;
                    break;

                case TerrainDef.TerrainEdgeType.Fade:
                    shader = ShaderDatabase.TerrainFade;
                    break;

                case TerrainDef.TerrainEdgeType.FadeRough:
                    shader = ShaderDatabase.TerrainFadeRough;
                    break;

                case TerrainDef.TerrainEdgeType.Water:
                    shader = ShaderDatabase.TerrainWater;
                    break;
                }
                this.graphic = GraphicDatabase.Get <Graphic_Terrain>(this.texturePath, shader, Vector2.one, this.color, 2000 + this.renderPrecedence);
                if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater)
                {
                    this.graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
                }
                if (!this.waterDepthShader.NullOrEmpty())
                {
                    this.waterDepthMaterial             = new Material(ShaderDatabase.LoadShader(this.waterDepthShader));
                    this.waterDepthMaterial.renderQueue = 2000 + this.renderPrecedence;
                    this.waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
                    if (this.waterDepthShaderParameters != null)
                    {
                        for (int i = 0; i < this.waterDepthShaderParameters.Count; i++)
                        {
                            this.waterDepthMaterial.SetFloat(this.waterDepthShaderParameters[i].name, this.waterDepthShaderParameters[i].value);
                        }
                    }
                }
            });
            base.PostLoad();
        }
コード例 #3
0
        private void <PostLoad> m__0()
        {
            Shader shader = null;

            switch (this.edgeType)
            {
            case TerrainDef.TerrainEdgeType.Hard:
                shader = ShaderDatabase.TerrainHard;
                break;

            case TerrainDef.TerrainEdgeType.Fade:
                shader = ShaderDatabase.TerrainFade;
                break;

            case TerrainDef.TerrainEdgeType.FadeRough:
                shader = ShaderDatabase.TerrainFadeRough;
                break;

            case TerrainDef.TerrainEdgeType.Water:
                shader = ShaderDatabase.TerrainWater;
                break;
            }
            this.graphic = GraphicDatabase.Get <Graphic_Terrain>(this.texturePath, shader, Vector2.one, this.color, 2000 + this.renderPrecedence);
            if (shader == ShaderDatabase.TerrainFadeRough || shader == ShaderDatabase.TerrainWater)
            {
                this.graphic.MatSingle.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
            }
            if (!this.waterDepthShader.NullOrEmpty())
            {
                this.waterDepthMaterial             = MaterialAllocator.Create(ShaderDatabase.LoadShader(this.waterDepthShader));
                this.waterDepthMaterial.renderQueue = 2000 + this.renderPrecedence;
                this.waterDepthMaterial.SetTexture("_AlphaAddTex", TexGame.AlphaAddTex);
                if (this.waterDepthShaderParameters != null)
                {
                    for (int i = 0; i < this.waterDepthShaderParameters.Count; i++)
                    {
                        this.waterDepthShaderParameters[i].Apply(this.waterDepthMaterial);
                    }
                }
            }
        }