diff --git a/Assets/Fungus/Scripts/Commands/Math/Abs.cs b/Assets/Fungus/Scripts/Commands/Math/Abs.cs index 8b9bc27e..0859907b 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Abs.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Abs.cs @@ -17,10 +17,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Abs"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/BaseUnaryMathCommand.cs b/Assets/Fungus/Scripts/Commands/Math/BaseUnaryMathCommand.cs index 253d834e..4a59709b 100644 --- a/Assets/Fungus/Scripts/Commands/Math/BaseUnaryMathCommand.cs +++ b/Assets/Fungus/Scripts/Commands/Math/BaseUnaryMathCommand.cs @@ -21,5 +21,15 @@ namespace Fungus return new Color32(235, 191, 217, 255); } + public override string GetSummary() + { + return "in: " + (inValue.floatRef != null ? inValue.floatRef.Key : inValue.Value.ToString()) + + ", out: " + (outValue.floatRef != null ? outValue.floatRef.Key : outValue.Value.ToString()); + } + + public override bool HasReference(Variable variable) + { + return variable == inValue.floatRef || variable == outValue.floatRef; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Clamp.cs b/Assets/Fungus/Scripts/Commands/Math/Clamp.cs index 75ce2934..181e3bf5 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Clamp.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Clamp.cs @@ -55,7 +55,16 @@ namespace Fungus public override string GetSummary() { - return Mode.Clamp.ToString() + (mode != Mode.Clamp ? " & " + mode.ToString() : ""); + if (outValue.floatRef == null) + return "Error: no output value selected"; + + return outValue.floatRef.Key + " = " + Mode.Clamp.ToString() + (mode != Mode.Clamp ? " & " + mode.ToString() : ""); + } + + public override bool HasReference(Variable variable) + { + return lower.floatRef == variable || upper.floatRef == variable || value.floatRef == variable || + outValue.floatRef == variable; } public override Color GetButtonColor() diff --git a/Assets/Fungus/Scripts/Commands/Math/Curve.cs b/Assets/Fungus/Scripts/Commands/Math/Curve.cs index 69c8d76a..9d15bece 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Curve.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Curve.cs @@ -20,10 +20,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Curve"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Exp.cs b/Assets/Fungus/Scripts/Commands/Math/Exp.cs index 6e5c4723..5489c1a6 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Exp.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Exp.cs @@ -17,10 +17,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Exp"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Inv.cs b/Assets/Fungus/Scripts/Commands/Math/Inv.cs index fcd6a5d3..029761c3 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Inv.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Inv.cs @@ -19,10 +19,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Inverse 1/f"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/InvLerp.cs b/Assets/Fungus/Scripts/Commands/Math/InvLerp.cs index a593dc0d..a0f86c83 100644 --- a/Assets/Fungus/Scripts/Commands/Math/InvLerp.cs +++ b/Assets/Fungus/Scripts/Commands/Math/InvLerp.cs @@ -35,7 +35,16 @@ namespace Fungus public override string GetSummary() { - return "InvLerp [" + a.Value.ToString() + "-" + b.Value.ToString() + "]"; + if (outValue.floatRef == null) + return "Error: no out value selected"; + + return outValue.floatRef.Key + " = [" + a.Value.ToString() + "-" + b.Value.ToString() + "]"; + } + + public override bool HasReference(Variable variable) + { + return a.floatRef == variable || b.floatRef == variable || value.floatRef == variable || + outValue.floatRef == variable; } public override Color GetButtonColor() diff --git a/Assets/Fungus/Scripts/Commands/Math/Lerp.cs b/Assets/Fungus/Scripts/Commands/Math/Lerp.cs index 5caedf46..e98055ae 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Lerp.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Lerp.cs @@ -54,6 +54,12 @@ namespace Fungus return mode.ToString() + " [" + a.Value.ToString() + "-" + b.Value.ToString() + "]"; } + public override bool HasReference(Variable variable) + { + return a.floatRef == variable || b.floatRef == variable || percentage.floatRef == variable || + outValue.floatRef == variable; + } + public override Color GetButtonColor() { return new Color32(235, 191, 217, 255); diff --git a/Assets/Fungus/Scripts/Commands/Math/Log.cs b/Assets/Fungus/Scripts/Commands/Math/Log.cs index 2c7da4bb..8875f974 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Log.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Log.cs @@ -40,17 +40,7 @@ namespace Fungus public override string GetSummary() { - switch (mode) - { - case Mode.Base10: - return "Log Base 10"; - case Mode.Natural: - return "Natural Log"; - default: - break; - } - - return "Log"; + return mode.ToString() + " " + base.GetSummary(); } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Map.cs b/Assets/Fungus/Scripts/Commands/Math/Map.cs index 61f7fb23..3f653ad4 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Map.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Map.cs @@ -40,6 +40,13 @@ namespace Fungus newRangeLower.Value.ToString() + "-" + newRangeUpper.Value.ToString() + "]"; } + public override bool HasReference(Variable variable) + { + return initialRangeLower.floatRef == variable || initialRangeUpper.floatRef == variable || value.floatRef == variable || + newRangeLower.floatRef == variable || newRangeUpper.floatRef == variable || + outValue.floatRef == variable; + } + public override Color GetButtonColor() { return new Color32(235, 191, 217, 255); diff --git a/Assets/Fungus/Scripts/Commands/Math/MinMax.cs b/Assets/Fungus/Scripts/Commands/Math/MinMax.cs index 9efeb0a0..7294454f 100644 --- a/Assets/Fungus/Scripts/Commands/Math/MinMax.cs +++ b/Assets/Fungus/Scripts/Commands/Math/MinMax.cs @@ -43,19 +43,24 @@ namespace Fungus break; } - Continue(); } public override string GetSummary() { - return function.ToString(); + return function.ToString() + " " + + "out: " + (outValue.floatRef != null ? outValue.floatRef.Key : outValue.Value.ToString()) + + " [" + inLHSValue.Value.ToString() + " - " + inRHSValue.Value.ToString() + "]"; + } + + public override bool HasReference(Variable variable) + { + return inLHSValue.floatRef == variable || inRHSValue.floatRef == variable || outValue.floatRef == variable; } public override Color GetButtonColor() { return new Color32(235, 191, 217, 255); } - } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Neg.cs b/Assets/Fungus/Scripts/Commands/Math/Neg.cs index 883ef7de..1f063868 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Neg.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Neg.cs @@ -17,10 +17,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Negate"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Pow.cs b/Assets/Fungus/Scripts/Commands/Math/Pow.cs index e20db290..586c43c5 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Pow.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Pow.cs @@ -27,7 +27,10 @@ namespace Fungus public override string GetSummary() { - return "Pow"; + if (outValue.floatRef == null) + return "Error: No out value selected"; + + return outValue.floatRef.Key + " = " + baseValue.Value.ToString() + "^" + exponentValue.Value.ToString(); } public override Color GetButtonColor() @@ -35,5 +38,10 @@ namespace Fungus return new Color32(235, 191, 217, 255); } + public override bool HasReference(Variable variable) + { + return baseValue.floatRef == variable || exponentValue.floatRef == variable || + outValue.floatRef == variable; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Round.cs b/Assets/Fungus/Scripts/Commands/Math/Round.cs index 418893f7..d7ddc301 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Round.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Round.cs @@ -44,7 +44,7 @@ namespace Fungus public override string GetSummary() { - return function.ToString(); + return function.ToString() + " " + base.GetSummary(); } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Sign.cs b/Assets/Fungus/Scripts/Commands/Math/Sign.cs index d3b3ebb9..89fea7b8 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Sign.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Sign.cs @@ -17,10 +17,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Sign"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Sqrt.cs b/Assets/Fungus/Scripts/Commands/Math/Sqrt.cs index 57500efe..d8e9485c 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Sqrt.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Sqrt.cs @@ -17,10 +17,5 @@ namespace Fungus Continue(); } - - public override string GetSummary() - { - return "Sqrt"; - } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/ToInt.cs b/Assets/Fungus/Scripts/Commands/Math/ToInt.cs index e4a15b24..cf8596ca 100644 --- a/Assets/Fungus/Scripts/Commands/Math/ToInt.cs +++ b/Assets/Fungus/Scripts/Commands/Math/ToInt.cs @@ -35,17 +35,17 @@ namespace Fungus { switch (function) { - case Mode.RoundToInt: - outValue.Value = Mathf.RoundToInt(inValue.Value); - break; - case Mode.FloorToInt: - outValue.Value = Mathf.FloorToInt(inValue.Value); - break; - case Mode.CeilToInt: - outValue.Value = Mathf.CeilToInt(inValue.Value); - break; - default: - break; + case Mode.RoundToInt: + outValue.Value = Mathf.RoundToInt(inValue.Value); + break; + case Mode.FloorToInt: + outValue.Value = Mathf.FloorToInt(inValue.Value); + break; + case Mode.CeilToInt: + outValue.Value = Mathf.CeilToInt(inValue.Value); + break; + default: + break; } Continue(); @@ -53,7 +53,9 @@ namespace Fungus public override string GetSummary() { - return function.ToString(); + return function.ToString() + + " in: " + (inValue.floatRef != null ? inValue.floatRef.Key : inValue.Value.ToString()) + + ", out: " + (outValue.integerRef != null ? outValue.integerRef.Key : outValue.Value.ToString()); ; } public override Color GetButtonColor() @@ -61,5 +63,9 @@ namespace Fungus return new Color32(235, 191, 217, 255); } + public override bool HasReference(Variable variable) + { + return variable == inValue.floatRef || variable == outValue.integerRef; + } } } \ No newline at end of file diff --git a/Assets/Fungus/Scripts/Commands/Math/Trig.cs b/Assets/Fungus/Scripts/Commands/Math/Trig.cs index 998cf902..2ef5b78a 100644 --- a/Assets/Fungus/Scripts/Commands/Math/Trig.cs +++ b/Assets/Fungus/Scripts/Commands/Math/Trig.cs @@ -22,8 +22,7 @@ namespace Fungus Sin, Tan } - - + [Tooltip("Trigonometric function to run.")] [SerializeField] protected Function function = Function.Sin; @@ -65,13 +64,7 @@ namespace Fungus public override string GetSummary() { - return function.ToString(); + return function.ToString() + " " + base.GetSummary(); } - - public override Color GetButtonColor() - { - return new Color32(235, 191, 217, 255); - } - } } \ No newline at end of file