private void OnTaskCreatedEvent(TaskCreatedEvent e)
        {
            Repository.States[e.NewTask.Id] = e.NewTask;

            RootTaskId = e.NewTask.Desc.Id;
            NextTaskId = Math.Max(NextTaskId, e.NewTask.Desc.Id) + 1;

            NodeLayoutHelper.Calculate(this);
        }
        private void OnTaskCreatedEvent(TaskCreatedEvent e)
        {
            Repository.States[e.NewTask.Id] = e.NewTask;

            if (Desc is DecoratorTaskDescWrapper)
            {
                var desc = (DecoratorTaskDescWrapper)Desc;
                desc.ChildTaskId = e.NewTask.Desc.Id;
            }
            else if (Desc is CompositeTaskDescWrapper)
            {
                var desc = (CompositeTaskDescWrapper)Desc;
                desc.ChildTaskIds.Add(e.NewTask.Desc.Id);
            }

            var tree = (BehaviorTreeState)Repository.States[BehaviorTreeState.GetId()];

            tree.NextTaskId = Math.Max(tree.NextTaskId, e.NewTask.Desc.Id) + 1;
            NodeLayoutHelper.Calculate(tree);
        }