public void SetSpline(CustomSpline spline) { if (spline == null) { Debug.LogError("Spline null"); } customSpline = spline; track = customSpline.CalcSpline(); }
// Update is called once per frame void Update() { if (splineFollow.done) { distancePastElements += splineFollow.customSpline.distance; Element entering = genManager.EnteringAuto(); CustomSpline cS = entering.GetComponent <CustomSpline>(); splineFollow.SetSpline(cS); splineFollow.ResetFollow(); splineFollow.AdjustSpeed(cS.ElementDefaultSpeed); AvatarController ac = FindObjectOfType <AvatarController>(); if (ac != null) { ac.moveRate = entering.Biome.moveRate; } } distanceRun = distancePastElements + splineFollow.trackPosition * splineFollow.customSpline.distance; if (GameManager.Instance != null && GameManager.Instance.ScoreManagerInstance != null) { GameManager.Instance.ScoreManagerInstance.SetDistancePoints(Mathf.FloorToInt(distanceRun / 10)); } }