private Goal LoadGoal(string name, YamlNode value, IDictionary<string, Goal> loadedGoals)
{
var mappingNode = value as YamlMappingNode;
if (mappingNode != null)
{
var incorporates = new List<Goal>();
foreach (var pair in parser.EnumerateNamedNodesOf(value, "incorporates"))
{
string childName = pair.Key;
Goal g;
if (!loadedGoals.TryGetValue(childName, out g))
{
g = new Goal(childName);
}
incorporates.Add(g);
}
return new Goal(name, incorporates);
}
else
{
return new Goal(name);
}
}