//updates the pathTask if it hasn't been completed, makes a new pathTask if it has. public void updatePathTask(Vector3 start, Vector3 finish) { if (currentTask == null || currentTask.finishedTask) { //get the old pathHolder, and set the path if the task has been finished. PathHolder oldPathHolder = null; if (currentTask != null && currentTask.pathHolder != null) { oldPathHolder = currentTask.pathHolder; path = currentTask.pathHolder.path; } //create a new task, set it to the current task currentTask = new PathTask(start, finish, oldPathHolder, costIncrease); //add the task map.AddTask(currentTask); } else { currentTask.start = start; currentTask.finish = finish; } }
public void AddTask(PathTask pt) { tasks.Add(pt); }