public bool Run(ref RSQuery query, RSManager manager, GameObject gameObject) { if (this.disabled) { return(false); } foreach (var critereonName in this.criteria) { if (!manager.criteria.ContainsKey(critereonName)) { return(false); } RSCriterion critereon = manager.criteria[critereonName]; if (query.Matches(critereon) || critereon.Optional) { continue; } return(false); } if (this.Flags.HasFlag(RSRuleFlags.NoRepeat)) { this.disabled = true; } return(manager.RunResponses(this.responses, ref query, gameObject)); }
void AddCriterion(string name, RSCriterion criterion) { if (this.criteria.ContainsKey(name)) { throw new Exception("The criterion [" + name + "] is already defined, cannot add a new criterion named this"); } this.criteria.Add(name, criterion); }
public bool Matches(RSCriterion critereon) { if (this.facts.Facts.ContainsKey(critereon.Matchkey)) { return(critereon.Matches(this.facts.Facts[critereon.Matchkey])); } foreach (var facts in this.extraFactDictionaries) { if (facts.Facts.ContainsKey(critereon.Matchkey)) { return(critereon.Matches(facts.Facts[critereon.Matchkey])); } } return(false); }