Ejemplo n.º 1
0
 private void Init()
 {
     if (this.graphicClass == null)
     {
         this.cachedGraphic = null;
     }
     else
     {
         ShaderType sType = this.shaderType;
         if (this.shaderType == ShaderType.None)
         {
             sType = ShaderType.Cutout;
         }
         Shader shader = ShaderDatabase.ShaderFromType(sType);
         this.cachedGraphic = GraphicDatabase.Get(this.graphicClass, this.texPath, shader, this.drawSize, this.color, this.colorTwo, this);
         if (this.onGroundRandomRotateAngle > 0.0099999997764825821)
         {
             this.cachedGraphic = new Graphic_RandomRotated(this.cachedGraphic, this.onGroundRandomRotateAngle);
         }
         if (this.Linked)
         {
             this.cachedGraphic = GraphicUtility.WrapLinked(this.cachedGraphic, this.linkType);
         }
     }
 }
Ejemplo n.º 2
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();
        }
Ejemplo n.º 3
0
        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();
        }
Ejemplo n.º 4
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);
                    }
                }
            }
        }