Ejemplo n.º 1
0
        /// <summary>
        /// Create a new Entity and trigger the OnCreateEntity event
        /// </summary>
        /// <typeparam name="T">type extending Entity</typeparam>
        /// <returns>the new Entity</returns>
        public T CreateEntity <T>() where T : Entity
        {
            var entity = (T)Activator.CreateInstance(typeof(T), this);

            entityComponentMap.Add(entity.Id, new Tuple <Entity, List <IComponent> >(entity, new List <IComponent>()));
            OnCreateEntity?.Invoke(this, entity);
            return(entity);
        }
Ejemplo n.º 2
0
 private static void InvokeOnCreateEntity(InteractiveBehaviour obj, bool isCreated)
 {
     OnCreateEntity?.Invoke(obj, isCreated);
 }