| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108 |
- using System;
- using ETModel;
- namespace ETHotfix
- {
- public partial class Entity
- {
- private Entity CreateWithComponentParent(Type type)
- {
- Entity component;
- if (type.IsDefined(typeof (NoObjectPool), false))
- {
- component = (Entity)Activator.CreateInstance(type);
- }
- else
- {
- component = Game.ObjectPool.Fetch(type);
- }
-
- this.Domain = parent.Domain;
- component.Id = parent.Id;
- component.ComponentParent = parent;
-
- Game.EventSystem.Awake(component);
- return component;
- }
- private T CreateWithComponentParent<T>(bool isFromPool = true) where T : Entity
- {
- Type type = typeof (T);
- Entity component;
- if (!isFromPool)
- {
- component = (Entity)Activator.CreateInstance(type);
- }
- else
- {
- component = Game.ObjectPool.Fetch(type);
- }
- component.Domain = this.Domain;
- component.Id = this.Id;
- component.ComponentParent = this;
-
- Game.EventSystem.Awake(component);
- return (T)component;
- }
- private T CreateWithComponentParent<T, A>(A a, bool isFromPool = true) where T : Entity
- {
- Type type = typeof (T);
- Entity component;
- if (!isFromPool)
- {
- component = (Entity)Activator.CreateInstance(type);
- }
- else
- {
- component = Game.ObjectPool.Fetch(type);
- }
- component.Domain = this.Domain;
- component.Id = this.Id;
- component.ComponentParent = this;
-
- Game.EventSystem.Awake(component, a);
- return (T)component;
- }
- private T CreateWithComponentParent<T, A, B>(A a, B b, bool isFromPool = true) where T : Entity
- {
- Type type = typeof (T);
- Entity component;
- if (!isFromPool)
- {
- component = (Entity)Activator.CreateInstance(type);
- }
- else
- {
- component = Game.ObjectPool.Fetch(type);
- }
- component.Domain = this.Domain;
- component.Id = this.Id;
- component.ComponentParent = this;
-
- Game.EventSystem.Awake(component, a, b);
- return (T)component;
- }
- private T CreateWithComponentParent<T, A, B, C>(A a, B b, C c, bool isFromPool = true) where T : Entity
- {
- Type type = typeof (T);
- Entity component;
- if (!isFromPool)
- {
- component = (Entity)Activator.CreateInstance(type);
- }
- else
- {
- component = Game.ObjectPool.Fetch(type);
- }
- component.Domain = this.Domain;
- component.Id = this.Id;
- component.ComponentParent = this;
-
- Game.EventSystem.Awake(component, a, b, c);
- return (T)component;
- }
- }
- }
|