using System; namespace ET { public static class EntityFactory { public static Entity CreateWithParent(Type type, Entity parent) { Entity component = Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component); return component; } public static T CreateWithParent(Entity parent) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component); return component; } public static T CreateWithParent(Entity parent, A a) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component, a); return component; } public static T CreateWithParent(Entity parent, A a, B b) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component, a, b); return component; } public static T CreateWithParent(Entity parent, A a, B b, C c, bool fromPool = true) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component, a, b, c); return component; } public static T CreateWithParent(Entity parent, A a, B b, C c, D d, bool fromPool = true) where T : Entity { Type type = typeof(T); T component = (T)Entity.Create(type, true); component.Id = IdGenerater.GenerateId(); component.Parent = parent; EventSystem.Instance.Awake(component, a, b, c, d); return component; } public static Entity CreateWithParentAndId(Type type, Entity parent, long id) { Entity component = Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component); return component; } public static T CreateWithParentAndId(Entity parent, long id) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component); return component; } public static T CreateWithParentAndId(Entity parent, long id, A a) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component, a); return component; } public static T CreateWithParentAndId(Entity parent, long id, A a, B b) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component, a, b); return component; } public static T CreateWithParentAndId(Entity parent, long id, A a, B b, C c, bool fromPool = true) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component, a, b, c); return component; } public static T CreateWithParentAndId(Entity parent, long id, A a, B b, C c, D d, bool fromPool = true) where T : Entity { Type type = typeof(T); T component = (T)Entity.Create(type, true); component.Id = id; component.Parent = parent; EventSystem.Instance.Awake(component, a, b, c, d); return component; } public static Entity Create(Entity domain, Type type) { Entity component = Entity.Create(type, true); component.Domain = domain; component.Id = IdGenerater.GenerateId(); EventSystem.Instance.Awake(component); return component; } public static T Create(Entity domain) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = IdGenerater.GenerateId(); EventSystem.Instance.Awake(component); return component; } public static T Create(Entity domain, A a) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = IdGenerater.GenerateId(); EventSystem.Instance.Awake(component, a); return component; } public static T Create(Entity domain, A a, B b) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = IdGenerater.GenerateId(); EventSystem.Instance.Awake(component, a, b); return component; } public static T Create(Entity domain, A a, B b, C c) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = IdGenerater.GenerateId(); EventSystem.Instance.Awake(component, a, b, c); return component; } public static T CreateWithId(Entity domain, long id) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = id; EventSystem.Instance.Awake(component); return component; } public static T CreateWithId(Entity domain, long id, A a) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = id; EventSystem.Instance.Awake(component, a); return component; } public static T CreateWithId(Entity domain, long id, A a, B b) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = id; EventSystem.Instance.Awake(component, a, b); return component; } public static T CreateWithId(Entity domain, long id, A a, B b, C c) where T : Entity { Type type = typeof (T); T component = (T)Entity.Create(type, true); component.Domain = domain; component.Id = id; EventSystem.Instance.Awake(component, a, b, c); return component; } } }