internal void AddTask(DependentTask taskBase)
        {
            UnfinishedTaskDic.SetAddValue(taskBase.Internal.TaskName, taskBase);

            if (taskBase.CheckAllDependentTaskFinished())
            {
                taskBase.ExecuteTask();
            }
        }
        internal void OnTaskFinished(string taskName)
        {
            if (!UnfinishedTaskDic.ContainsKey(taskName))
            {
                return;
            }

            DependentTask task = UnfinishedTaskDic[taskName];

            UnfinishedTaskDic.Remove(taskName);
            FinishedTaskDic.Add(taskName, task);

            CheckExecuteTask();
        }
        internal void RegisterTask(DependentTask taskBase)
        {
            if (taskBase == null ||
                taskBase.Internal == null ||
                string.IsNullOrEmpty(taskBase.Internal.TaskRegionId) ||
                string.IsNullOrEmpty(taskBase.Internal.TaskName))
            {
                return;
            }

            string regionId = taskBase.Internal.TaskRegionId;

            CheckCreateRegion(regionId);

            _TaskRegionDic[regionId].AddTask(taskBase);
        }
        private void CreateTask(string taskName, List <string> taskDependent)
        {
            DependentTask task = new DependentTask().SetTaskRegion("null").SetTaskName(taskName).SetTaskAction((TaskExecuteCallback callback) =>
            {
                VeerDebug.Log(" task start : " + taskName);
                float duration = UnityEngine.Random.Range(1f, 4f);
                this.StartCoroutine(CoroutineUtils.WaitForSecond(duration, () =>
                {
                    VeerDebug.Log(" task finished : " + taskName + " , duration : " + duration);
                    callback(true, null, null);
                }));
            });

            if (taskDependent != null)
            {
                for (int i = 0; i < taskDependent.Count; i++)
                {
                    task.AddDependentTask(taskDependent[i]);
                }
            }

            task.RegisterTask();
        }
        internal void CheckExecuteTask()
        {
            foreach (var p in UnfinishedTaskDic)
            {
                DependentTask task = p.Value;
                if (task.Internal.bTaskRunning)
                {
                    continue;
                }

#if UNITY_EDITOR
                if (task.Internal.bTaskFinished)
                {
                    VeerDebug.LogError(" a finished task is in unfinished task list : " + task.Internal.TaskName);
                    continue;
                }
#endif

                if (task.CheckAllDependentTaskFinished())
                {
                    task.ExecuteTask();
                }
            }
        }