public void AddTask(string taskIdentifier, Func <BehaviorTask> taskCreator, float initialScore = 0) { if (taskDictionary.ContainsKey(taskIdentifier) == false) { taskDictionary[taskIdentifier] = new TaskDescription(taskIdentifier, taskCreator, initialScore); } }
public TaskDescription GetHighestRanked() { TaskDescription highestRanked = null; string highestRankedKey = null; foreach (var taskDesc in taskDictionary) { if (highestRanked == null || taskDesc.Value.Score > highestRanked.Score) { highestRanked = taskDesc.Value; highestRankedKey = taskDesc.Key; } } if (highestRankedKey != null) { taskDictionary.Remove(highestRankedKey); } return(highestRanked); }