/// <summary> /// Evaluates the event condition. /// </summary> /// <returns></returns> public bool Evaluate() { bool result = Condition.Invoke(); if (InvertCondition) { return(!result); } return(result); }
/// <summary> /// Evaluates this comparison operation. /// </summary> /// <returns></returns> public bool Evaluate() { _result = false; switch (ComparisonType) { case ComparisonTypes.Int: _result = Compare(FirstInt.Value, SecondInt.Value, ThirdInt.Value); break; case ComparisonTypes.Float: _result = Compare(FirstFloat.Value, SecondFloat.Value, ThirdFloat.Value); break; case ComparisonTypes.String: _result = Compare(FirstString.Value, SecondString.Value, null); break; case ComparisonTypes.Bool: _result = Compare(FirstBool.Value, SecondBool.Value, null); break; case ComparisonTypes.Data: _result = CompareData(FirstData, SecondData); break; case ComparisonTypes.Method: _result = ConditionalEvent.Invoke(); break; } // Only invoke the response while we are playing. // This avoids any issues where actions are dependent on play mode only functionality. if (Application.isPlaying || RespondInEditor) { if (_result) { OnComparisonSuccess.Invoke(); } else { OnComparisonFail.Invoke(); } } return(_result); }