public static Component Create(Entity behaviorTreeParent, HotfixComposite hotfixComposite) { try { var behaviorTreeConfig = (BehaviorTreeConfig)Game.Scene.GetComponent <ConfigComponent>().Get(typeof(BehaviorTreeConfig), hotfixComposite.behaviorTreeConfigID); var type = Type.GetType($"ETHotfix.{behaviorTreeConfig.ComponentName}"); Component component = Game.ObjectPool.Fetch(type); ComponentWithId componentWithId = component as ComponentWithId; if (componentWithId != null) { componentWithId.Id = component.InstanceId; } Game.EventSystem.Awake(component, behaviorTreeParent, hotfixComposite, behaviorTreeConfig); if (string.Equals(hotfixComposite.FriendlyName, "Hotfix Composite")) { hotfixComposite.FriendlyName = behaviorTreeConfig.Name; } return(component); } catch (Exception e) { Log.Error(e); } return(null); }
public static Entity Create(Entity behaviorTreeParent, HotfixComposite hotfixComposite) { try { var behaviorTreeConfig = (BehaviorTreeConfig)Game.Scene.GetComponent <ConfigComponent>().Get(typeof(BehaviorTreeConfig), hotfixComposite.behaviorTreeConfigID); var type = Type.GetType($"DCET.Hotfix.{behaviorTreeConfig.ComponentName}"); var component = Game.ObjectPool.Fetch(type); component.Domain = behaviorTreeParent.Domain; component.Id = behaviorTreeParent.Id; Game.EventSystem.Awake(component, behaviorTreeParent, hotfixComposite, behaviorTreeConfig); if (string.Equals(hotfixComposite.FriendlyName, "Hotfix Composite")) { hotfixComposite.FriendlyName = behaviorTreeConfig.Name; } return(component); } catch (Exception e) { Log.Error(e); } return(null); }