public override void OnEnter() { PriorityIndex.Clear(); Children.Clear(); Children.AddRange(Childs.ToArray()); RandList.Clear(); PriorityList = new List <int>(); RepeatIntFieldDesigner repeatIntField = Node["Priority"].Field as RepeatIntFieldDesigner; List <int> tempList = repeatIntField.Value; if (Childs.Count == 1) { Status = DebugNodeStatus.Error; return; } if (tempList.Count != Childs.Count) { Status = DebugNodeStatus.Error; return; } PriorityList.AddRange(tempList.ToArray()); RateSortChildren(); }
public override void OnEnter() { Children.Clear(); Children.AddRange(Childs.ToArray()); Random random = new Random(); //打乱子节点 int count = Children.Count; for (int index = 0; index < count; index++) { int randIndex = random.Next(index, count); DebugNode node = Children[randIndex]; Children[randIndex] = Children[index]; Children[index] = node; } }