From fccfb6c54260514d20722d954d227bdc4549c709 Mon Sep 17 00:00:00 2001 From: Jorge Ramirez Date: Sun, 8 Apr 2018 20:44:08 -0400 Subject: [PATCH] Add functionality for addition, subtraction and multiplication to the Color variable --- .../Scripts/VariableTypes/ColorVariable.cs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/Assets/Fungus/Scripts/VariableTypes/ColorVariable.cs b/Assets/Fungus/Scripts/VariableTypes/ColorVariable.cs index bbd7d824..eb30ba44 100644 --- a/Assets/Fungus/Scripts/VariableTypes/ColorVariable.cs +++ b/Assets/Fungus/Scripts/VariableTypes/ColorVariable.cs @@ -15,7 +15,12 @@ namespace Fungus public class ColorVariable : VariableBase { public static readonly CompareOperator[] compareOperators = { CompareOperator.Equals, CompareOperator.NotEquals }; - public static readonly SetOperator[] setOperators = { SetOperator.Assign }; + public static readonly SetOperator[] setOperators = { + SetOperator.Assign, + SetOperator.Add, + SetOperator.Subtract, + SetOperator.Multiply + }; protected static bool ColorsEqual(Color a, Color b) { return ColorUtility.ToHtmlStringRGBA(a) == ColorUtility.ToHtmlStringRGBA(b); @@ -48,6 +53,15 @@ namespace Fungus case SetOperator.Assign: Value = value; break; + case SetOperator.Add: + Value += value; + break; + case SetOperator.Subtract: + Value -= value; + break; + case SetOperator.Multiply: + Value *= value; + break; default: Debug.LogError("The " + setOperator.ToString() + " set operator is not valid."); break;