Exemplo n.º 1
0
        public GameObject DrawRoadSegment(RoadSegment[] roadSegments, int currentSegmentIndex)
        {
            RoadSegment roadSegment = roadSegments[currentSegmentIndex];

            switch (roadSegment.roadType)
            {
            case RoadType.DeadEnd:
                return(DrawDeadEnd(roadSegment.coords, roadSegment.direction));

            case RoadType.Straight:
                return(DrawStraight(roadSegment.coords, roadSegment.direction));

            case RoadType.Turn:
                return(DrawTurn(roadSegment.coords, roadSegment.direction));

            case RoadType.TJunction:
                return(DrawTJunction(roadSegment.coords, roadSegment.direction));

            case RoadType.CrossRoads:
                return(DrawCrossRoad(roadSegment.coords));

            default:
                // should never get here
                return(null);
            }
        }
Exemplo n.º 2
0
 public RoadSegment[] CreateRoadSegments(PathNode[] nodes)
 {
     RoadSegment[] roadSegments = new RoadSegment[nodes.Length];
     for (int currentIndex = 0; currentIndex < nodes.Length; currentIndex++)
     {
         roadSegments [currentIndex] = CreateRoadSegment(nodes, currentIndex);
     }
     return(roadSegments);
 }