示例#1
0
        /// <summary>
        /// Creates and returns a CombatEntity from a given template.
        /// </summary>
        /// <param name="template">The template used to insert spawn the CombatEntity.</param>
        /// <returns>Returns a read-only reference to the CombatEntity if the operation was successful. Else returns null.</returns>
        public async Task <IReadOnlyCombatEntity> CreateAsync(CharacterTemplate template)
        {
            var entity = await _combatEntityFactory.CreateAsync(template);

            lock (_lock)
            {
                _combatEntities.Add(entity.Id, entity);
            }

            return(entity);
        }