Пример #1
0
        // Test the variables according to the comparison string
        public bool Evaluate()
        {
            // Check the comparer
            if (_comparer == null)
            {
                DialogueLogger.LogError("Trying to evaluate a condition, but the comparison operator is null");
                return(false);
            }

            // Get values
            var var1 = Variables[0].GetValue();
            var var2 = Variables[1].GetValue();

            if (var1 == null || var2 == null)
            {
                DialogueLogger.LogWarning($"Trying to evaluate a condition but one or more of the variables are null");
                return(false);
            }

            // Evaluate
            // We're using dynamics here, so be careful. We'll have to validate types on the conversation load
            return(_comparer.Execute(var1, var2));
        }