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);
        }
Example #2
0
        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);
        }
Example #3
0
        public void Awake(Entity behaviorTreeParent, HotfixAction hotfixAction, BehaviorTreeConfig behaviorTreeConfig)
        {
            this.hotfixAction = hotfixAction;

            if (this.hotfixAction != null)
            {
                this.hotfixAction.onTick = OnTick;
            }
        }
Example #4
0
        public override void Dispose()
        {
            if (IsDisposed)
            {
                return;
            }

            base.Dispose();

            if (hotfixAction != null)
            {
                hotfixAction.onTick = null;
            }

            hotfixAction = null;
        }