Browse Source

Add error messages when using invalid variable operators

master
Jorge Ramirez 7 years ago
parent
commit
f23e5f192a
  1. 8
      Assets/Fungus/Scripts/VariableTypes/BooleanVariable.cs
  2. 7
      Assets/Fungus/Scripts/VariableTypes/FloatVariable.cs
  3. 8
      Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs
  4. 7
      Assets/Fungus/Scripts/VariableTypes/IntegerVariable.cs
  5. 8
      Assets/Fungus/Scripts/VariableTypes/StringVariable.cs

8
Assets/Fungus/Scripts/VariableTypes/BooleanVariable.cs

@ -29,9 +29,11 @@ namespace Fungus
condition = lhs == rhs;
break;
case CompareOperator.NotEquals:
default:
condition = lhs != rhs;
break;
default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");
break;
}
return condition;
@ -41,13 +43,15 @@ namespace Fungus
{
switch (setOperator)
{
default:
case SetOperator.Assign:
Value = value;
break;
case SetOperator.Negate:
Value = !value;
break;
default:
Debug.LogError("The " + setOperator.ToString() + " set operator is not valid.");
break;
}
}
}

7
Assets/Fungus/Scripts/VariableTypes/FloatVariable.cs

@ -56,6 +56,9 @@ namespace Fungus
case CompareOperator.GreaterThanOrEquals:
condition = lhs >= rhs;
break;
default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");
break;
}
return condition;
@ -65,7 +68,6 @@ namespace Fungus
{
switch (setOperator)
{
default:
case SetOperator.Assign:
Value = value;
break;
@ -81,6 +83,9 @@ namespace Fungus
case SetOperator.Divide:
Value /= value;
break;
default:
Debug.LogError("The " + setOperator.ToString() + " set operator is not valid.");
break;
}
}
}

8
Assets/Fungus/Scripts/VariableTypes/GameObjectVariable.cs

@ -30,9 +30,11 @@ namespace Fungus
condition = lhs == rhs;
break;
case CompareOperator.NotEquals:
default:
condition = lhs != rhs;
break;
default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");
break;
}
return condition;
@ -42,10 +44,12 @@ namespace Fungus
{
switch (setOperator)
{
default:
case SetOperator.Assign:
Value = value;
break;
default:
Debug.LogError("The " + setOperator.ToString() + " set operator is not valid.");
break;
}
}
}

7
Assets/Fungus/Scripts/VariableTypes/IntegerVariable.cs

@ -56,6 +56,9 @@ namespace Fungus
case CompareOperator.GreaterThanOrEquals:
condition = lhs >= rhs;
break;
default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");
break;
}
return condition;
@ -65,7 +68,6 @@ namespace Fungus
{
switch (setOperator)
{
default:
case SetOperator.Assign:
Value = value;
break;
@ -81,6 +83,9 @@ namespace Fungus
case SetOperator.Divide:
Value /= value;
break;
default:
Debug.LogError("The " + setOperator.ToString() + " set operator is not valid.");
break;
}
}
}

8
Assets/Fungus/Scripts/VariableTypes/StringVariable.cs

@ -29,9 +29,11 @@ namespace Fungus
condition = lhs == rhs;
break;
case CompareOperator.NotEquals:
default:
condition = lhs != rhs;
break;
default:
Debug.LogError("The " + compareOperator.ToString() + " comparison operator is not valid.");
break;
}
return condition;
@ -41,10 +43,12 @@ namespace Fungus
{
switch (setOperator)
{
default:
case SetOperator.Assign:
Value = value;
break;
default:
Debug.LogError("The " + setOperator.ToString() + " set operator is not valid.");
break;
}
}
}

Loading…
Cancel
Save