示例#1
0
        /// <summary>
        /// Creates a determined entity info.
        /// </summary>
        /// <typeparam name="T">Type of the entity.</typeparam>
        /// <param name="tag">The tag.</param>
        /// <param name="group">The group.</param>
        /// <returns>
        /// New entity instance.
        /// </returns>
        public T Create <T>(string tag = null, string group = null)
            where T : Entity, new()
        {
            T entity = new T();

            entity.Id      = this.CreateId();
            entity.Tag     = tag;
            entity.Group   = group;
            entity.Manager = this;

            ComponentHelper.CreateComponents(entity);

            this.addedEntities.Enqueue(entity);
            return(entity);
        }