/// <summary> /// Get all the dead creatures in the context. /// /// A creature is dead when the energy is equal to or lower then 0. /// </summary> /// <returns>List of all the dead creatures in the context</returns> public ReadOnlyCollection <Creature> GetDeadCreatures() => SimObjects.OfType <Creature>().Where(c => c.IsAlive == false).ToList().AsReadOnly();
/// <summary> /// get all simobjects of a certain SimObject type /// </summary> /// <typeparam name="TSimObject">A type of SimObject</typeparam> /// <returns></returns> public ReadOnlyCollection <TSimObject> GetSimObjects <TSimObject>() where TSimObject : SimObject { var so = SimObjects.OfType <TSimObject>().ToList(); return(new ReadOnlyCollection <TSimObject>(so)); }