/// <summary> /// Move an entity into a named container in this /// </summary> /// <typeparam name="T">the type of the entity to add</typeparam> /// <param name="thing">the entity to add</param> /// <param name="containerName">the name of the container</param> /// <returns>errors</returns> public string MoveInto <T>(T thing, string containerName) { var implimentedTypes = DataUtility.GetAllImplimentingedTypes(typeof(T)); if (implimentedTypes.Contains(typeof(IInanimate))) { var obj = (IInanimate)thing; if (Contents.Contains(obj, containerName)) { return("That is already in the container"); } Contents.Add(obj, containerName); obj.CurrentLocation = this; this.UpsertToLiveWorldCache(); return(string.Empty); } if (implimentedTypes.Contains(typeof(IMobile))) { var obj = (IMobile)thing; if (MobilesInside.Contains(obj, containerName)) { return("That is already in the container"); } MobilesInside.Add(obj, containerName); obj.CurrentLocation = this; this.UpsertToLiveWorldCache(); return(string.Empty); } if (implimentedTypes.Contains(typeof(IPathway))) { var obj = (IPathway)thing; if (Pathways.Contains(obj, containerName)) { return("That is already in the container"); } Pathways.Add(obj, containerName); obj.CurrentLocation = this; this.UpsertToLiveWorldCache(); return(string.Empty); } return("Invalid type to move to container."); }
public void AddPathway(Direction direction, Locale locale) { Pathways.Add(direction, locale); }