/// <summary>
    /// Set the default values.
    /// </summary>
    protected override void ResetDefaultValues()
    {
      if (effect == null)
        effect = this.target as SpriteColorMasks3;

      effect.strength = 1.0f;
      effect.pixelOp = SpriteColorHelper.PixelOp.Multiply;

      effect.strengthMaskRed = 1.0f;
      effect.colorMaskRed = Color.white;
      effect.textureMaskRedUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
      effect.textureMaskRedUVAngle = 0.0f;

      effect.strengthMaskGreen = 1.0f;
      effect.colorMaskGreen = Color.white;
      effect.textureMaskGreenUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
      effect.textureMaskGreenUVAngle = 0.0f;

      effect.strengthMaskBlue = 1.0f;
      effect.colorMaskBlue = Color.white;
      effect.textureMaskBlueUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
      effect.textureMaskBlueUVAngle = 0.0f;

      base.ResetDefaultValues();
    }
Ejemplo n.º 2
0
    private void OnEnable()
    {
      spriteColorMask = gameObject.GetComponent<SpriteColorMasks3>();
      if (spriteColorMask == null)
        this.enabled = false;
      else
      {
        blendModesValues = new SpriteColorHelper.PixelOp[11];
        blendModesValues[0] = SpriteColorHelper.PixelOp.Burn;
        blendModesValues[1] = SpriteColorHelper.PixelOp.Darken;
        blendModesValues[2] = SpriteColorHelper.PixelOp.Darker;
        blendModesValues[3] = SpriteColorHelper.PixelOp.Dodge;
        blendModesValues[4] = SpriteColorHelper.PixelOp.HardMix;
        blendModesValues[5] = SpriteColorHelper.PixelOp.HardLight;
        blendModesValues[6] = SpriteColorHelper.PixelOp.Lighten;
        blendModesValues[7] = SpriteColorHelper.PixelOp.Luminosity;
        blendModesValues[8] = SpriteColorHelper.PixelOp.Overlay;
        blendModesValues[9] = SpriteColorHelper.PixelOp.SoftLight;
        blendModesValues[10] = SpriteColorHelper.PixelOp.VividLight;

        if (changeBlendModes == true)
          ChangeBlendMode();

        if (changeColors == true)
          ChangeColors();

        timeToChange = Random.Range(0.0f, changeTime * 0.5f);

        UpdateTextureColors();
      }
    }
        /// <summary>
        /// Set the default values.
        /// </summary>
        protected override void ResetDefaultValues()
        {
            if (baseTarget == null)
            {
                baseTarget = this.target as SpriteColorMasks3;
            }

            baseTarget.strength = 1.0f;
            baseTarget.pixelOp  = SpriteColorHelper.PixelOp.Multiply;

            baseTarget.strengthMaskRed        = 1.0f;
            baseTarget.colorMaskRed           = Color.white;
            baseTarget.textureMaskRedUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
            baseTarget.textureMaskRedUVAngle  = 0.0f;

            baseTarget.strengthMaskGreen        = 1.0f;
            baseTarget.colorMaskGreen           = Color.white;
            baseTarget.textureMaskGreenUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
            baseTarget.textureMaskGreenUVAngle  = 0.0f;

            baseTarget.strengthMaskBlue        = 1.0f;
            baseTarget.colorMaskBlue           = Color.white;
            baseTarget.textureMaskBlueUVParams = new Vector4(1.0f, 1.0f, 0.0f, 0.0f);
            baseTarget.textureMaskBlueUVAngle  = 0.0f;

            base.ResetDefaultValues();
        }
Ejemplo n.º 4
0
    void Start()
    {
        _collider      = GetComponent <Collider2D>();
        mask           = GetComponent <SpriteColorFX.SpriteColorMasks3>();
        spriteRenderer = GetComponent <SpriteRenderer>();
        animator       = GetComponent <Animator>();

        //Camera.main.GetComponent<AudioSource>().time = 40f;
    }
Ejemplo n.º 5
0
        private void OnEnable()
        {
            spriteColorMask = gameObject.GetComponent <SpriteColorMasks3>();
            if (spriteColorMask == null)
            {
                this.enabled = false;
            }
            else
            {
                blendModesValues     = new SpriteColorHelper.PixelOp[11];
                blendModesValues[0]  = SpriteColorHelper.PixelOp.Burn;
                blendModesValues[1]  = SpriteColorHelper.PixelOp.Darken;
                blendModesValues[2]  = SpriteColorHelper.PixelOp.Darker;
                blendModesValues[3]  = SpriteColorHelper.PixelOp.Dodge;
                blendModesValues[4]  = SpriteColorHelper.PixelOp.HardMix;
                blendModesValues[5]  = SpriteColorHelper.PixelOp.HardLight;
                blendModesValues[6]  = SpriteColorHelper.PixelOp.Lighten;
                blendModesValues[7]  = SpriteColorHelper.PixelOp.Luminosity;
                blendModesValues[8]  = SpriteColorHelper.PixelOp.Overlay;
                blendModesValues[9]  = SpriteColorHelper.PixelOp.SoftLight;
                blendModesValues[10] = SpriteColorHelper.PixelOp.VividLight;

                if (changeBlendModes == true)
                {
                    ChangeBlendMode();
                }

                if (changeColors == true)
                {
                    ChangeColors();
                }

                timeToChange = Random.Range(0.0f, changeTime * 0.5f);

                UpdateTextureColors();
            }
        }
    /// <summary>
    /// Inspector.
    /// </summary>
    protected override void Inspector()
    {
			if (effect == null)
				effect = base.target as SpriteColorMasks3;

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

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

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

				effect.strengthMaskRed = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(effect.strengthMaskRed * 100f), 0, 100, 100) * 0.01f;
				  
        effect.colorMaskRed = EditorGUILayout.ColorField(@"Color", effect.colorMaskRed);
				  
        effect.textureMaskRed = (EditorGUILayout.ObjectField(new GUIContent(@"Texture (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), effect.textureMaskRed, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
				if (effect.textureMaskRed != null)
        {
          EditorGUILayout.LabelField(@"UV params");
            
          UVParamsInspectorGUI(ref effect.textureMaskRedUVParams, ref effect.textureMaskRedUVAngle);
        }

				EditorGUI.indentLevel--;
			}

      EditorGUILayout.LabelField(@"#2 mask (green)");
			{
				EditorGUI.indentLevel++;
				  
        effect.strengthMaskGreen = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(effect.strengthMaskGreen * 100f), 0, 100, 100) * 0.01f;
				  
        effect.colorMaskGreen = EditorGUILayout.ColorField(@"Color", effect.colorMaskGreen);

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

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

				EditorGUI.indentLevel--;
			}

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

				effect.strengthMaskBlue = (float)SpriteColorFXEditorHelper.IntSliderWithReset(@"Strength", SpriteColorFXEditorHelper.TooltipStrength, Mathf.RoundToInt(effect.strengthMaskBlue * 100f), 0, 100, 100) * 0.01f;
          
        effect.colorMaskBlue = EditorGUILayout.ColorField(@"Color", effect.colorMaskBlue);

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

				EditorGUI.indentLevel--;
			}

			EditorGUILayout.Separator();

      effect.textureMask = (EditorGUILayout.ObjectField(new GUIContent(@"Mask #1 (RGB)", SpriteColorFXEditorHelper.TooltipTextureMask), this.effect.textureMask, typeof(Texture2D), false, GUILayout.Height(54.0f)) as Texture2D);
		}
        /// <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);
        }