/// <summary> /// Get the current luminosity rating of the place you're in /// </summary> /// <returns>The current Luminosity</returns> public override float GetCurrentLuminosity() { float lumins = 0; foreach (IInanimate thing in Contents.EntitiesContained()) { lumins += thing.GetCurrentLuminosity(); } return(lumins); }
/// <summary> /// Get all of the entities matching a type inside this in a named container /// </summary> /// <typeparam name="T">the type</typeparam> /// <returns>the contained entities</returns> /// <param name="containerName">the name of the container</param> public IEnumerable <T> GetContents <T>(string containerName) { IEnumerable <Type> implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T)); List <T> contents = new List <T>(); if (implimentedTypes.Contains(typeof(IMobile))) { contents.AddRange(MobilesInside.EntitiesContained(containerName).Select(ent => (T)ent)); } if (implimentedTypes.Contains(typeof(IInanimate))) { contents.AddRange(Contents.EntitiesContained(containerName).Select(ent => (T)ent)); } return(contents); }
/// <summary> /// Get the current luminosity rating of the place you're in /// </summary> /// <returns>The current Luminosity</returns> public override float GetCurrentLuminosity() { float lumins = 0; IZone zone = CurrentLocation.CurrentZone; if (zone != null) { zone.GetCurrentLuminosity(); } foreach (IMobile dude in MobilesInside.EntitiesContained()) { lumins += dude.GetCurrentLuminosity(); } foreach (IInanimate thing in Contents.EntitiesContained()) { lumins += thing.GetCurrentLuminosity(); } return(lumins); }
/// <summary> /// Get all of the entities matching a type inside this /// </summary> /// <typeparam name="T">the type</typeparam> /// <returns>the contained entities</returns> public IEnumerable <T> GetContents <T>() { var implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T)); var contents = new List <T>(); if (implimentedTypes.Contains(typeof(IMobile))) { contents.AddRange(MobilesInside.EntitiesContained().Select(ent => (T)ent)); } if (implimentedTypes.Contains(typeof(IInanimate))) { contents.AddRange(Contents.EntitiesContained().Select(ent => (T)ent)); } if (implimentedTypes.Contains(typeof(IPathway))) { contents.AddRange(Pathways.EntitiesContained().Select(ent => (T)ent)); } return(contents); }