public bool CongruentTo(BehaviorCriteria otherCriteria) { if (otherCriteria.BehaviorAddress != BehaviorAddress) { return(false); } if (GfxId.HasValue && otherCriteria.GfxId.HasValue && GfxId.Value != otherCriteria.GfxId.Value) { return(false); } if (SubType.HasValue && otherCriteria.SubType.HasValue && SubType.Value != otherCriteria.SubType.Value) { return(false); } if (Appearance.HasValue && otherCriteria.Appearance.HasValue && Appearance.Value != otherCriteria.Appearance.Value) { return(false); } if (SpawnObj.HasValue && otherCriteria.SpawnObj.HasValue && SpawnObj.Value != otherCriteria.SpawnObj.Value) { return(false); } return(true); }
public string GetObjectName(BehaviorCriteria behaviorCriteria) { var assoc = FindObjectAssociation(behaviorCriteria); if (assoc == null) { return("Unknown Object"); } return(assoc.Name); }
public bool GetObjectMapRotates(BehaviorCriteria behaviorCriteria) { var assoc = FindObjectAssociation(behaviorCriteria); if (assoc == null) { return(false); } return(assoc.RotatesOnMap); }
public List <WatchVariableControl> GetWatchVarControls(BehaviorCriteria behaviorCriteria) { var assoc = FindObjectAssociation(behaviorCriteria); if (assoc == null) { return(new List <WatchVariableControl>()); } else { return(assoc.WatchVariableControls); } }
public Image GetObjectMapImage(BehaviorCriteria behaviorCriteria) { if (behaviorCriteria.BehaviorAddress == 0) { return(EmptyImage); } var assoc = FindObjectAssociation(behaviorCriteria); if (assoc == null) { return(_defaultImage); } return(assoc.MapImage); }
public Image GetObjectImage(BehaviorCriteria behaviorCriteria, bool transparent) { if (behaviorCriteria.BehaviorAddress == 0) { return(EmptyImage); } var assoc = FindObjectAssociation(behaviorCriteria); if (assoc == null) { return(transparent ? _transparentDefaultImage : _defaultImage); } return(transparent ? assoc.TransparentImage : assoc.Image); }
public BehaviorCriteria?Generalize(BehaviorCriteria otherCriteria) { if (otherCriteria.BehaviorAddress != BehaviorAddress) { return(null); } if (GfxId.HasValue && otherCriteria.GfxId.HasValue && GfxId.Value != otherCriteria.GfxId.Value) { return new BehaviorCriteria() { BehaviorAddress = BehaviorAddress } } ; if (SubType.HasValue && otherCriteria.SubType.HasValue && SubType.Value != otherCriteria.SubType.Value) { return new BehaviorCriteria() { BehaviorAddress = BehaviorAddress, GfxId = GfxId } } ; if (Appearance.HasValue && otherCriteria.Appearance.HasValue && Appearance.Value != otherCriteria.Appearance.Value) { return new BehaviorCriteria() { BehaviorAddress = BehaviorAddress, GfxId = GfxId, SubType = SubType } } ; if (SpawnObj.HasValue && otherCriteria.SpawnObj.HasValue && SpawnObj.Value != otherCriteria.SpawnObj.Value) { return new BehaviorCriteria() { BehaviorAddress = BehaviorAddress, GfxId = GfxId, SubType = SubType, Appearance = Appearance } } ; return(this); }
public ObjectBehaviorAssociation FindObjectAssociation(BehaviorCriteria behaviorCriteria) { if (_cachedObjAssoc.ContainsKey(behaviorCriteria)) { return(_cachedObjAssoc[behaviorCriteria]); } var possibleAssoc = _objAssoc.Where(objAssoc => objAssoc.MeetsCriteria(behaviorCriteria)); if (possibleAssoc.Count() > 1 && possibleAssoc.Any(objAssoc => objAssoc.BehaviorCriteria.BehaviorOnly())) { possibleAssoc = possibleAssoc.Where(objAssoc => !objAssoc.BehaviorCriteria.BehaviorOnly()); } var behaviorAssoc = possibleAssoc.FirstOrDefault(); _cachedObjAssoc[behaviorCriteria] = behaviorAssoc; return(behaviorAssoc); }
public bool RecognizedBehavior(BehaviorCriteria behaviorCriteria) { var assoc = FindObjectAssociation(behaviorCriteria); return(assoc != null); }
public bool MeetsCriteria(BehaviorCriteria behaviorCriteria) { return(Criteria.CongruentTo(behaviorCriteria)); }