public override void setNextNode(PathAI pathAi) { print(state); if (state == TrafficLight.RED) { listeners.Add(pathAi); pathAi.node = null; pathAi.setTarget(); } else { base.setNextNode(pathAi); } }
public virtual void setNextNode(PathAI pathAi) { var c = connections; if (pathAi.prevNode != null && c.Count > 1) { print(pathAi.prevNode); c = connections.FindAll(node => node.transform.position != pathAi.prevNode.transform.position); } pathAi.prevNode = pathAi.node; print(c.Count); pathAi.node = c[Random.Range(0, c.Count)]; pathAi.setTarget(); }