//private GameVehicleAIDriverController aiDriverController; public void OnDrawGizmos() { //if (active && (!Application.isPlaying || show)) if (!Application.isPlaying) { //color = renderer.material.color; color = renderer.sharedMaterial.color; string fullName = gameObject.name; int delimiterPos = fullName.LastIndexOf("_"); string preFix = fullName.Substring(0, delimiterPos); string strNumber = fullName.Substring(delimiterPos + 1); int intNumber; if (int.TryParse(strNumber, out intNumber)) { intNumber += 1; string nextWpName = preFix + "_" + intNumber.ToString(); Transform nextWP = gameObject.transform.parent.Find(nextWpName); if (nextWP != null) { //if (show && active) if (show) { nextWP.GetComponent <Renderer>().sharedMaterial.color = renderer.sharedMaterial.color; Debug.DrawLine(transform.position, nextWP.position, color); } DrawLineToNext drawLineToNext = nextWP.gameObject.GetComponent <DrawLineToNext>() as DrawLineToNext; if (drawLineToNext != null) { //drawLineToNext.active = active; drawLineToNext.show = show; } //DrawLineToNext drawLineToNext = nextWP.GetComponent<DrawLineToNext>() as DrawLineToNext; //drawLineToNext.active = active; //drawLineToNext.show = show; } //Catmull Rom - Kubisch Hermitescher Spline - cSpline } } }
void SetDrawLineToNext() { if (waypointActive) { } bool found = true; int counter = 1; path.Clear(); while (found) { GameObject go; string currentName; currentName = "/" + m_waypointFolder + "/" + m_waypointPreName + counter.ToString(); go = GameObject.Find(currentName); if (go != null) { DrawLineToNext drawLineToNext = go.GetComponent <DrawLineToNext>() as DrawLineToNext; if (drawLineToNext != null) { if (waypointActive) { drawLineToNext.gameObject.SetActive(false); } else { drawLineToNext.gameObject.SetActive(true); } } } else { found = false; } } }