/// <summary>
        /// Inspector.
        /// </summary>
        protected override void Inspector()
        {
            if (baseTarget == null)
            baseTarget = this.target as SpriteColorRampMask;

              EditorGUIUtility.fieldWidth = 40.0f;

              baseTarget.palettes[0] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 1 (Red)", baseTarget.palettes[0]);

              baseTarget.palettes[1] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 2 (Green)", baseTarget.palettes[1]);

              baseTarget.palettes[2] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 3 (Blue)", baseTarget.palettes[2]);

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

              baseTarget.gammaCorrect = SpriteColorFXEditorHelper.SliderWithReset(@"Gamma", SpriteColorFXEditorHelper.TooltipGamma, baseTarget.gammaCorrect, 0.5f, 3.0f, 1.2f);

              baseTarget.uvScroll = SpriteColorFXEditorHelper.SliderWithReset(@"UV Scroll", SpriteColorFXEditorHelper.TooltipUVScroll, baseTarget.uvScroll, 0.0f, 1.0f, 0.0f);

              EditorGUIUtility.fieldWidth = 60.0f;

              SpriteColorFXEditorHelper.MinMaxSliderWithReset(@"Luminance range", SpriteColorFXEditorHelper.TooltipLuminanceRange, ref baseTarget.luminanceRangeMin, ref baseTarget.luminanceRangeMax, 0.0f, 1.0f, 0.0f, 1.0f);

              baseTarget.invertLum = SpriteColorFXEditorHelper.ToogleWithReset(@"Invert luminance", SpriteColorFXEditorHelper.TooltipInvertLuminance, baseTarget.invertLum, false);

              baseTarget.textureMask = EditorGUILayout.ObjectField(new GUIContent(@"Mask (RGBA)", SpriteColorFXEditorHelper.TooltipTextureMask), baseTarget.textureMask, typeof(Texture2D), false) as Texture2D;
        }
Esempio n. 2
0
        /// <summary>
        /// Inspector.
        /// </summary>
        protected override void Inspector()
        {
            if (effect == null)
            {
                effect = this.target as SpriteColorRampMask;
            }

            EditorGUIUtility.fieldWidth = 40.0f;

            effect.palettes[0] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 1 (Red)", effect.palettes[0]);

            effect.palettes[1] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 2 (Green)", effect.palettes[1]);

            effect.palettes[2] = (SpriteColorRampPalettes)EditorGUILayout.EnumPopup(@"Palette 3 (Blue)", effect.palettes[2]);

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

            effect.gammaCorrect = SpriteColorFXEditorHelper.SliderWithReset(@"Gamma", SpriteColorFXEditorHelper.TooltipGamma, effect.gammaCorrect, 0.5f, 3.0f, 1.2f);

            effect.uvScroll = SpriteColorFXEditorHelper.SliderWithReset(@"UV Scroll", SpriteColorFXEditorHelper.TooltipUVScroll, effect.uvScroll, 0.0f, 1.0f, 0.0f);

            EditorGUIUtility.fieldWidth = 60.0f;

            SpriteColorFXEditorHelper.MinMaxSliderWithReset(@"Luminance range", SpriteColorFXEditorHelper.TooltipLuminanceRange, ref effect.luminanceRangeMin, ref effect.luminanceRangeMax, 0.0f, 1.0f, 0.0f, 1.0f);

            effect.invertLum = SpriteColorFXEditorHelper.ToogleWithReset(@"Invert luminance", SpriteColorFXEditorHelper.TooltipInvertLuminance, effect.invertLum, false);

            effect.textureMask = EditorGUILayout.ObjectField(new GUIContent(@"Mask (RGBA)", SpriteColorFXEditorHelper.TooltipTextureMask), effect.textureMask, typeof(Texture2D), false) as Texture2D;
        }
Esempio n. 3
0
    private void OnEnable()
    {
      currentPalletes = new SpriteColorRampPalettes[3];

      valuePalletes = System.Enum.GetValues(typeof(SpriteColorRampPalettes));
      currentPalletes[0] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);
      currentPalletes[1] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);
      currentPalletes[2] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);

      spriteColorMaskFX = gameObject.GetComponent<SpriteColorRampMask>();

      textureRamp = Resources.Load<Texture2D>("Textures/SpriteColorRamps");

      texturePalletes = new Texture2D[3, 5];
      for (int i = 0; i < 5; ++i)
        for (int j = 0; j < 3; ++j)
          texturePalletes[j, i] = MakeTexture(14, 14, textureRamp.GetPixel((textureRamp.width / 5) * (i + 1), (int)currentPalletes[j]));
    }
        /// <summary>
        /// Set the default values.
        /// </summary>
        protected override void ResetDefaultValues()
        {
            if (baseTarget == null)
            baseTarget = this.target as SpriteColorRampMask;

              baseTarget.strength = 1.0f;

              baseTarget.gammaCorrect = 1.2f;

              baseTarget.uvScroll = 0.0f;

              baseTarget.invertLum = false;

              baseTarget.luminanceRangeMin = 0.0f;

              baseTarget.luminanceRangeMax = 1.0f;

              base.ResetDefaultValues();
        }
Esempio n. 5
0
        /// <summary>
        /// Set the default values.
        /// </summary>
        protected override void ResetDefaultValues()
        {
            if (effect == null)
            {
                effect = this.target as SpriteColorRampMask;
            }

            effect.strength = 1.0f;

            effect.gammaCorrect = 1.2f;

            effect.uvScroll = 0.0f;

            effect.invertLum = false;

            effect.luminanceRangeMin = 0.0f;

            effect.luminanceRangeMax = 1.0f;

            base.ResetDefaultValues();
        }
Esempio n. 6
0
        private void OnEnable()
        {
            currentPalletes = new SpriteColorRampPalettes[3];

            valuePalletes      = System.Enum.GetValues(typeof(SpriteColorRampPalettes));
            currentPalletes[0] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);
            currentPalletes[1] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);
            currentPalletes[2] = (SpriteColorRampPalettes)Random.Range(0, valuePalletes.Length);

            spriteColorMaskFX = gameObject.GetComponent <SpriteColorRampMask>();

            textureRamp = Resources.Load <Texture2D>("Textures/SpriteColorRamps");

            texturePalletes = new Texture2D[3, 5];
            for (int i = 0; i < 5; ++i)
            {
                for (int j = 0; j < 3; ++j)
                {
                    texturePalletes[j, i] = MakeTexture(14, 14, textureRamp.GetPixel((textureRamp.width / 5) * (i + 1), (int)currentPalletes[j]));
                }
            }
        }