public static bool Check(StatMachine statMachineLink, string StatId, System.Type expectedType) { Stat foundStat = null; if (statMachineLink.Statset.HasKey(StatId, out foundStat)) { return(foundStat.GetType().IsSubclassOf(expectedType) || foundStat.GetType() == expectedType); } return(false); }
/// <summary> /// Tries to evaluate the condition. If the fact this should compare to isn't found, returns false. /// </summary> /// <param name="statMachineLink">This stat machine will be searched for a matching fact with the same identifier.</param> public bool SelfEvaluate(StatMachine statMachineLink) { Fact searchResultFact = default; if (statMachineLink.FactStorage.HasKey(compareTo.Identifier, out searchResultFact)) { return(IsTrueForFact(searchResultFact)); } else { return(false); } }