// Upgrade NOTE: replaced 'mul(UNITY_MATRIX_MVP,*)' with 'UnityObjectToClipPos(*)' 
 | 
  
 | 
Shader "GUI/GUI_WaterWave" { 
 | 
  
 | 
    Properties 
 | 
    { 
 | 
        [PerRendererData] _MainTex("Sprite Texture", 2D) = "white" {} 
 | 
        _Color("Tint", Color) = (1,1,1,1) 
 | 
  
 | 
        _StencilComp("Stencil Comparison", Float) = 8 
 | 
        _Stencil("Stencil ID", Float) = 0 
 | 
        _StencilOp("Stencil Operation", Float) = 0 
 | 
        _StencilWriteMask("Stencil Write Mask", Float) = 255 
 | 
        _StencilReadMask("Stencil Read Mask", Float) = 255 
 | 
  
 | 
        _ColorMask("Color Mask", Float) = 15 
 | 
        _Progress("Progress",Range(0,1)) = 0 
 | 
    } 
 | 
  
 | 
        SubShader 
 | 
    { 
 | 
        Tags 
 | 
    { 
 | 
        "Queue" = "Transparent" 
 | 
        "IgnoreProjector" = "True" 
 | 
        "RenderType" = "Transparent" 
 | 
        "PreviewType" = "Plane" 
 | 
        "CanUseSpriteAtlas" = "True" 
 | 
    } 
 | 
  
 | 
        Stencil 
 | 
    { 
 | 
        Ref[_Stencil] 
 | 
        Comp[_StencilComp] 
 | 
        Pass[_StencilOp] 
 | 
        ReadMask[_StencilReadMask] 
 | 
        WriteMask[_StencilWriteMask] 
 | 
    } 
 | 
  
 | 
        Cull Off 
 | 
        Lighting Off 
 | 
        ZWrite Off 
 | 
        ZTest[unity_GUIZTestMode] 
 | 
        Blend SrcAlpha OneMinusSrcAlpha 
 | 
        ColorMask[_ColorMask] 
 | 
  
 | 
        Pass 
 | 
    { 
 | 
        CGPROGRAM 
 | 
    #pragma target 3.0 
 | 
    #pragma vertex vert 
 | 
    #pragma fragment frag 
 | 
    #include "UnityCG.cginc" 
 | 
  
 | 
        struct appdata_t 
 | 
    { 
 | 
        float4 vertex   : POSITION; 
 | 
        float4 color    : COLOR; 
 | 
        float2 texcoord : TEXCOORD0; 
 | 
    }; 
 | 
  
 | 
    struct v2f 
 | 
    { 
 | 
        float4 vertex   : SV_POSITION; 
 | 
        fixed4 color : COLOR; 
 | 
        half2 uv1  : TEXCOORD0; 
 | 
    }; 
 | 
  
 | 
    sampler2D _MainTex; 
 | 
    float4 _Color; 
 | 
    float _Progress; 
 | 
  
 | 
    v2f vert(appdata_t IN) 
 | 
    { 
 | 
        v2f OUT; 
 | 
        OUT.vertex = UnityObjectToClipPos(IN.vertex); 
 | 
        OUT.uv1 = IN.texcoord; 
 | 
        OUT.color = IN.color * _Color; 
 | 
        return OUT; 
 | 
    } 
 | 
  
 | 
    fixed4 frag(v2f i) : SV_Target 
 | 
    { 
 | 
        fixed4 outcolor = tex2D(_MainTex,i.uv1); 
 | 
        float a = outcolor.a; 
 | 
        outcolor.a *= 1 - clamp(sign(i.uv1.y - _Progress), 0, 1); 
 | 
  
 | 
        float timeRate = _Time; 
 | 
        if (i.uv1.y>_Progress  &&i.uv1.y<_Progress + 0.04*clamp(cos(timeRate * 10),0.5,1)*sin(i.uv1.x * 10 + timeRate * 100)) { 
 | 
        outcolor.a = a; 
 | 
        } 
 | 
        else if (i.uv1.y<_Progress && i.uv1.y>_Progress + 0.04* clamp(cos(timeRate * 10),0.5,1)* sin(i.uv1.x * 10 + timeRate * 100)) 
 | 
        { 
 | 
        outcolor.a = 0; 
 | 
        } 
 | 
  
 | 
    half grayscale = (outcolor.r + outcolor.g + outcolor.b) * 0.222; 
 | 
    outcolor.rgb = lerp(outcolor.rgb , grayscale.xxx,1-outcolor.a) ; 
 | 
    return outcolor; 
 | 
    } 
 | 
  
 | 
        ENDCG 
 | 
    } 
 | 
    } 
 | 
} 
 |