private void AddAllAILink(int level, int levelMax, Architecture root, List<Architecture> path) { path.Add(root); if (root != this) { double num = 0.0; for (int i = 1; i < path.Count; i++) { num += base.Scenario.GetDistance(path[i - 1].ArchitectureArea, path[i].ArchitectureArea); } if (!this.AIAllLinkNodes.ContainsKey(root.ID)) { LinkNode node = new LinkNode(); node.A = root; node.Level = level; foreach (Architecture architecture in path) { node.Path.Add(architecture); } node.Distance = num; this.AIAllLinkNodes.Add(root.ID, node); } else if ((this.AIAllLinkNodes[root.ID].Level == level) && (this.AIAllLinkNodes[root.ID].Distance > num)) { this.AIAllLinkNodes[root.ID].Distance = num; this.AIAllLinkNodes[root.ID].Path.Clear(); foreach (Architecture architecture in path) { this.AIAllLinkNodes[root.ID].Path.Add(architecture); } } else if (this.AIAllLinkNodes[root.ID].Level > level) { this.AIAllLinkNodes[root.ID].Level = level; this.AIAllLinkNodes[root.ID].Path.Clear(); foreach (Architecture architecture in path) { this.AIAllLinkNodes[root.ID].Path.Add(architecture); } } } if (level < levelMax) { foreach (Architecture architecture in root.GetAILinks()) { this.AILinkProcedureDetails.Enqueue(new AILinkProcedureDetail(level + 1, architecture, path)); } } }