示例#1
0
        /// <summary>
        /// Add entity to the world.
        /// </summary>
        ///
        /// <remarks>
        /// Compared to the <see cref="IWorldStorage.Add(string, object)"/> it allow to omit the
        /// name and it is generated automatically.
        /// </remarks>
        ///
        /// <returns>Returns generated name</returns>
        public static string Add(this IWorldStorage storage, object entity)
        {
            var name = Guid.NewGuid().ToString("N");

            storage.Add(name, entity);

            return(name);
        }
示例#2
0
 public static string Quest(
     this IWorldStorage storage,
     string description,
     string win = null
     )
 {
     return(storage.Add(new QuestEntity
     {
         Description = description,
         Win = win
     }));
 }
示例#3
0
 public FakeWorldRepository(IWorldStorage storage)
 {
     _storage = storage;
 }
示例#4
0
 public World()
 {
     _storage        = new WorldStorage();
     _worldGenerator = new DumbWorldGenerator(_storage.GetLastObjectId());
 }