public void RemoveTransition(uint laneId) { if (transitions == null) { return; } int index = -1; for (var i = 0; i < transitions.Length; ++i) { if (transitions[i].laneId == laneId) { index = i; break; } } if (index < 0) { return; } if (transitions.Length == 1) { Reset(); return; } LaneTransitionData[] newTransitions = new LaneTransitionData[transitions.Length - 1]; if (index > 0) { Array.Copy(transitions, 0, newTransitions, 0, index); } if (index < transitions.Length - 1) { Array.Copy( transitions, index + 1, newTransitions, index, transitions.Length - index - 1); } transitions = newTransitions; }
public void AddTransitions(LaneTransitionData[] transitionsToAdd) { if (transitions == null) { transitions = transitionsToAdd; routed = true; return; } var newTransitions = new LaneTransitionData[transitions.Length + transitionsToAdd.Length]; Array.Copy(transitions, newTransitions, transitions.Length); Array.Copy( transitionsToAdd, 0, newTransitions, transitions.Length, transitionsToAdd.Length); transitions = newTransitions; routed = true; }
public void AddTransition(LaneTransitionData transition) { AddTransitions(new LaneTransitionData[1] { transition }); }