public PlanWork Plan(IReGoapAgent agent, IReGoapGoal blacklistGoal, Queue <ReGoapActionState> currentPlan, Action <IReGoapGoal> callback)
    {
        var work = new PlanWork(agent, blacklistGoal, currentPlan, callback);

        lock (worksQueue)
        {
            worksQueue.Enqueue(work);
        }
        threadEvents.Set();
        return(work);
    }
    // called in another thread
    private void OnDonePlan(GoapPlannerThread plannerThread, PlanWork work, IReGoapGoal newGoal)
    {
        work.NewGoal = newGoal;
        lock (doneWorks)
        {
            doneWorks.Add(work);
#if DEBUG
            if (work.NewGoal != null)
            {
                ReGoapLogger.Log("[GoapPlannerManager] Done calculating plan, actions list:");
                var i = 0;
                foreach (var action in work.NewGoal.GetPlan())
                {
                    ReGoapLogger.Log(string.Format("{0}: {1}", i++, action.Action));
                }
            }
#endif
        }
    }