using System; namespace ETHotfix { public static class ComponentFactory { public static Component CreateWithParent(Type type, Component parent) { Component component = (Component)Game.ObjectPool.Fetch(type); component.Parent = parent; Game.EventSystem.Awake(component); return component; } public static T CreateWithParent(Component parent) where T : Component { T component = Game.ObjectPool.Fetch(); component.Parent = parent; Game.EventSystem.Awake(component); return component; } public static T CreateWithParent(Component parent, A a) where T : Component { T component = Game.ObjectPool.Fetch(); component.Parent = parent; Game.EventSystem.Awake(component, a); return component; } public static T CreateWithParent(Component parent, A a, B b) where T : Component { T component = Game.ObjectPool.Fetch(); component.Parent = parent; Game.EventSystem.Awake(component, a, b); return component; } public static T CreateWithParent(Component parent, A a, B b, C c) where T : Component { T component = Game.ObjectPool.Fetch(); component.Parent = parent; Game.EventSystem.Awake(component, a, b, c); return component; } public static T Create() where T : Component { T component = Game.ObjectPool.Fetch(); Game.EventSystem.Awake(component); return component; } public static T Create(A a) where T : Component { T component = Game.ObjectPool.Fetch(); Game.EventSystem.Awake(component, a); return component; } public static T Create(A a, B b) where T : Component { T component = Game.ObjectPool.Fetch(); Game.EventSystem.Awake(component, a, b); return component; } public static T Create(A a, B b, C c) where T : Component { T component = Game.ObjectPool.Fetch(); Game.EventSystem.Awake(component, a, b, c); return component; } public static T CreateWithId(long id) where T : Component { T component = Game.ObjectPool.Fetch(); component.Id = id; Game.EventSystem.Awake(component); return component; } public static T CreateWithId(long id, A a) where T : Component { T component = Game.ObjectPool.Fetch(); component.Id = id; Game.EventSystem.Awake(component, a); return component; } public static T CreateWithId(long id, A a, B b) where T : Component { T component = Game.ObjectPool.Fetch(); component.Id = id; Game.EventSystem.Awake(component, a, b); return component; } public static T CreateWithId(long id, A a, B b, C c) where T : Component { T component = Game.ObjectPool.Fetch(); component.Id = id; Game.EventSystem.Awake(component, a, b, c); return component; } } }