Exemplo n.º 1
0
        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);
        }
Exemplo n.º 2
0
        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);
        }