public override void Execute() { VsnArgument variableName = args[0]; VsnArgument valueToAdd = args[1]; float oldValue = VsnSaveSystem.GetFloatVariable(variableName.GetReference()); float newValue = oldValue - valueToAdd.GetNumberValue(); Debug.LogWarning("Subtrair " + valueToAdd.GetNumberValue() + " de " + variableName.GetReference()); VsnSaveSystem.SetVariable(variableName.GetReference(), newValue); VsnSaveSystem.Save(0); }
private bool CompareVariables(VsnArgument op1, VsnArgument op2) { /// TODO: also implement when the two variables are different types /// or when they're both strings return(CompareFloats(op1.GetNumberValue(), op2.GetNumberValue())); }
public bool EvaluateComparison(VsnArgument first, VsnArgument second) { if ((first.GetType() == typeof(VsnNumber) && second.GetType() == typeof(VsnNumber)) || (first.GetType() == typeof(VsnReference) && second.GetType() == typeof(VsnNumber)) || (first.GetType() == typeof(VsnNumber) && second.GetType() == typeof(VsnReference))) { return(CompareFloats(first.GetNumberValue(), second.GetNumberValue())); } if ((first.GetType() == typeof(VsnString) && second.GetType() == typeof(VsnString)) || (first.GetType() == typeof(VsnReference) && second.GetType() == typeof(VsnString)) || (first.GetType() == typeof(VsnString) && second.GetType() == typeof(VsnReference))) { return(CompareStrings(first.GetStringValue(), second.GetStringValue())); } return(CompareVariables(first, second)); }