Beispiel #1
0
        /// <summary>
        /// Set the pixel color operation.
        /// </summary>
        public void SetPixelOp(SpriteColorHelper.PixelOp pixelOp)
        {
            this.pixelOp = pixelOp;

              if (this.spriteRenderer != null)
            CreateMaterial();
        }
        /// <summary>
        /// Inspector.
        /// </summary>
        protected override void Inspector()
        {
            if (effect == null)
            {
                effect = this.target as SpriteColorDissolve;
            }

            EditorGUIUtility.fieldWidth = 40.0f;

            effect.dissolveAmount = SpriteColorFXEditorHelper.SliderWithReset(@"Amount", SpriteColorFXEditorHelper.TooltipNoiseAmount, effect.dissolveAmount * 100.0f, 0.0f, 100.0f, 0.0f) * 0.01f;

            DissolveShaderType newShaderType = (DissolveShaderType)EditorGUILayout.EnumPopup(new GUIContent(@"Shader", @"Texture type"), effect.shaderType);

            if (newShaderType != effect.shaderType)
            {
                effect.SetShaderType(newShaderType);
            }

            if (effect.shaderType != DissolveShaderType.Normal)
            {
                SpriteColorHelper.PixelOp newPixelOp = (SpriteColorHelper.PixelOp)EditorGUILayout.EnumPopup(new GUIContent(@"Blend mode", @"Blend modes"), effect.pixelOp);
                if (newPixelOp != effect.pixelOp)
                {
                    effect.SetPixelOp(newPixelOp);
                }
            }

            DissolveTextureType newTextureType = (DissolveTextureType)EditorGUILayout.EnumPopup(@"Dissolve type", effect.dissolveTextureType);

            if (newTextureType != effect.dissolveTextureType)
            {
                effect.SetTextureType(newTextureType);
            }

            if (effect.dissolveTextureType == DissolveTextureType.Custom)
            {
                effect.dissolveTexture = EditorGUILayout.ObjectField(@"Dissolve texture", effect.dissolveTexture, typeof(Texture), false) as Texture;
            }

            effect.dissolveUVScale = SpriteColorFXEditorHelper.SliderWithReset(@"Dissolve UV scale", SpriteColorFXEditorHelper.TooltipNoiseAmount, effect.dissolveUVScale, 0.1f, 5.0f, 1.0f);

            effect.dissolveInverse = EditorGUILayout.Toggle(new GUIContent(@"Invert", SpriteColorFXEditorHelper.TooltipNoiseAmount), effect.dissolveInverse);

            if (effect.shaderType != DissolveShaderType.Normal)
            {
                effect.dissolveBorderWitdh = SpriteColorFXEditorHelper.SliderWithReset(@"Border witdh", SpriteColorFXEditorHelper.TooltipNoiseAmount, effect.dissolveBorderWitdh * 500.0f, 0.0f, 100.0f, 50.0f) * 0.002f;
            }

            if (effect.shaderType == DissolveShaderType.BorderColor)
            {
                effect.dissolveBorderColor = SpriteColorFXEditorHelper.ColorWithReset(@"Border color", SpriteColorFXEditorHelper.TooltipNoiseAmount, effect.dissolveBorderColor, Color.grey);
            }
            else if (effect.shaderType == DissolveShaderType.BorderTexture)
            {
                effect.borderTexture = EditorGUILayout.ObjectField(@"Border texture", effect.borderTexture, typeof(Texture), false) as Texture;
                effect.borderUVScale = SpriteColorFXEditorHelper.SliderWithReset(@"Border UV scale", SpriteColorFXEditorHelper.TooltipNoiseAmount, effect.borderUVScale, 0.1f, 5.0f, 1.0f);
            }
        }
        /// <summary>
        /// Set the pixel color operation.
        /// </summary>
        public void SetPixelOp(SpriteColorHelper.PixelOp pixelOp)
        {
            this.pixelOp = pixelOp;

            if (this.spriteRenderer != null)
            {
                CreateMaterial();
            }
        }
        /// <summary>
        /// Inspector.
        /// </summary>
        protected override void Inspector()
        {
            if (baseTarget == null)
            {
                baseTarget = base.target as SpriteColorBlend;
            }

            EditorGUIUtility.fieldWidth = 40.0f;

            baseTarget.strength = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(baseTarget.strength * 100.0f), 0, 100, 100) * 0.01f;

            SpriteColorHelper.PixelOp newPixelOp = (SpriteColorHelper.PixelOp)EditorGUILayout.EnumPopup(new GUIContent(@"Blend mode", @"Blend modes"), baseTarget.pixelOp);
            if (newPixelOp != baseTarget.pixelOp)
            {
                baseTarget.SetPixelOp(newPixelOp);
            }
        }
        /// <summary>
        /// Inspector.
        /// </summary>
        protected override void Inspector()
        {
            if (baseTarget == null)
            {
                baseTarget = base.target as SpriteColorMasks3;
            }

            EditorGUIUtility.fieldWidth = 40.0f;

            baseTarget.strength = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(baseTarget.strength * 100.0f), 0, 100, 100) * 0.01f;

            SpriteColorHelper.PixelOp newPixelOp = (SpriteColorHelper.PixelOp)EditorGUILayout.EnumPopup(new GUIContent(@"Blend mode", @"Blend modes"), baseTarget.pixelOp);
            if (newPixelOp != baseTarget.pixelOp)
            {
                baseTarget.SetPixelOp(newPixelOp);
            }

            EditorGUILayout.LabelField(@"#1 mask (red)");
            {
                EditorGUI.indentLevel++;

                baseTarget.strengthMaskRed = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(baseTarget.strengthMaskRed * 100f), 0, 100, 100) * 0.01f;

                baseTarget.colorMaskRed = EditorGUILayout.ColorField(@"Color", baseTarget.colorMaskRed);

                baseTarget.textureMaskRed = (EditorGUILayout.ObjectField(new GUIContent(@"Texture (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), baseTarget.textureMaskRed, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
                if (baseTarget.textureMaskRed != null)
                {
                    EditorGUILayout.LabelField(@"UV params");

                    UVParamsInspectorGUI(ref baseTarget.textureMaskRedUVParams, ref baseTarget.textureMaskRedUVAngle);
                }

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.LabelField(@"#2 mask (green)");
            {
                EditorGUI.indentLevel++;

                baseTarget.strengthMaskGreen = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(baseTarget.strengthMaskGreen * 100f), 0, 100, 100) * 0.01f;

                baseTarget.colorMaskGreen = EditorGUILayout.ColorField(@"Color", baseTarget.colorMaskGreen);

                baseTarget.textureMaskGreen = (EditorGUILayout.ObjectField(new GUIContent(@"Texture (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), baseTarget.textureMaskGreen, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
                if (baseTarget.textureMaskGreen != null)
                {
                    EditorGUILayout.LabelField(@"UV params");

                    UVParamsInspectorGUI(ref baseTarget.textureMaskGreenUVParams, ref baseTarget.textureMaskGreenUVAngle);
                }

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.LabelField(@"#3 mask (blue)");
            {
                EditorGUI.indentLevel++;

                baseTarget.strengthMaskBlue = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(baseTarget.strengthMaskBlue * 100f), 0, 100, 100) * 0.01f;

                baseTarget.colorMaskBlue = EditorGUILayout.ColorField(@"Color", baseTarget.colorMaskBlue);

                baseTarget.textureMaskBlue = (EditorGUILayout.ObjectField(new GUIContent(@"Texture (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), baseTarget.textureMaskBlue, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
                if (baseTarget.textureMaskBlue != null)
                {
                    EditorGUILayout.LabelField(@"UV params");

                    UVParamsInspectorGUI(ref baseTarget.textureMaskBlueUVParams, ref baseTarget.textureMaskBlueUVAngle);
                }

                EditorGUI.indentLevel--;
            }

            EditorGUILayout.Separator();

            baseTarget.textureMask = (EditorGUILayout.ObjectField(new GUIContent(@"Mask #1 (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), this.baseTarget.textureMask, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
        }