コード例 #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
     }));
 }