public static Component Create(Entity behaviorTreeParent, HotfixAction hotfixAction) { try { var behaviorTreeConfig = (BehaviorTreeConfig)Game.Scene.GetComponent <ConfigComponent>().Get(typeof(BehaviorTreeConfig), hotfixAction.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, hotfixAction, behaviorTreeConfig); if (string.Equals(hotfixAction.FriendlyName, "Hotfix Action")) { hotfixAction.FriendlyName = behaviorTreeConfig.Name; } return(component); } catch (Exception e) { Log.Error(e); } return(null); }
public static Entity Create(Entity behaviorTreeParent, HotfixAction hotfixAction) { try { var behaviorTreeConfig = (BehaviorTreeConfig)Game.Scene.GetComponent <ConfigComponent>().Get(typeof(BehaviorTreeConfig), hotfixAction.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, hotfixAction, behaviorTreeConfig); if (string.Equals(hotfixAction.FriendlyName, "Hotfix Action")) { hotfixAction.FriendlyName = behaviorTreeConfig.Name; } return(component); } catch (Exception e) { Log.Error(e); } return(null); }
public void Awake(Entity behaviorTreeParent, HotfixAction hotfixAction, BehaviorTreeConfig behaviorTreeConfig) { this.hotfixAction = hotfixAction; if (this.hotfixAction != null) { this.hotfixAction.onTick = OnTick; } }
public override void Dispose() { if (IsDisposed) { return; } base.Dispose(); if (hotfixAction != null) { hotfixAction.onTick = null; } hotfixAction = null; }