void OnTriggerEnter() { // get the Track Controller GameObject TrackController = GameObject.Find("TrackController"); roadStructure rs = TrackController.GetComponent <roadStructure>(); // get the Navigation Controller GameObject navController = GameObject.Find("NavigationController"); navigationManager nav = navController.GetComponent <navigationManager>(); roadController rc = TrackController.GetComponent <roadController>(); // Shift the road generation to our alternate path. rc.setTrackSegment02(parentSegment); // Dump the current navigation and set it to start with our new path. nav.initializeDirections(); foreach (GameObject trackSegment in trackSegments) { nav.queDirection(trackSegment.GetComponent <Direction>()); } nav.displayNextDirection(); // Generate the next set of track on the alt path. rc.GenerateTrack(rc.TrackLength); // Mark that we've reached this segment for the car reset functionality. passed = true; rs.setLastSegmentPassed(parentSegment); // We're done with this trigger...shut it off. gameObject.GetComponent <BoxCollider>().enabled = false; }
void OnTriggerEnter() { // get the Track Controller GameObject TrackController = GameObject.Find("TrackController"); roadStructure rs = TrackController.GetComponent <roadStructure>(); // get the Navigation Controller GameObject navController = GameObject.Find("NavigationController"); navigationManager nav = navController.GetComponent <navigationManager>(); if (midpoint) { //Debug.Log("CHECKPOINT"); roadController rc = TrackController.GetComponent <roadController>(); rc.GenerateTrack(rc.TrackLength); } passed = true; rs.setLastSegmentPassed(segmentTransform); nav.displayNextDirection(); gameObject.GetComponent <BoxCollider>().enabled = false; }