void OnTriggerEnter(Collider other) { TrafficAI AI = other.gameObject.GetComponent <TrafficAI>(); if (AI && AI.type == type) { Vector3 dest = GetRandomDestination(AI); AI.MoveToNextDestination(dest); } }
private Vector3 GetRandomDestination(TrafficAI InAI) { var Positions_Map = StationContorller.Instance.Map_Positions; List <Edge> edges = ParentGraph.adj(Id); edges.Sort((Left, Right) => { return(Left.WeightAsRoad - Right.WeightAsRoad); }); Edge minWeightEdge = edges[0]; minWeightEdge.WeightAsRoad++; return(Positions_Map[type][minWeightEdge.End]); }