public object GetActiveOrScheduled <T>(DateTime currentTime) where T : class { if (typeof(T).IsSubclassOf(typeof(DiseaseDefinitionBase))) { return(ActiveDiseases.ToList().FirstOrDefault(x => (x.IsActiveNow || x.DiseaseStartTime >= currentTime) && x.Disease.GetType() == typeof(T))); } if (typeof(T).IsSubclassOf(typeof(InjuryBase))) { return(ActiveInjuries.ToList().FirstOrDefault(x => (x.IsActiveNow || x.InjuryTriggerTime >= currentTime) && x.Injury.GetType() == typeof(T))); } return(null); }
public object GetActive <T>() where T : class { if (typeof(T).IsSubclassOf(typeof(DiseaseDefinitionBase))) { return(ActiveDiseases.ToList().FirstOrDefault(x => x.IsActiveNow && x.Disease.GetType() == typeof(T))); } if (typeof(T).IsSubclassOf(typeof(InjuryBase))) { return(ActiveInjuries.ToList().FirstOrDefault(x => x.IsActiveNow && x.Injury.GetType() == typeof(T))); } return(null); }