void Start() { var pos = transform.position; pos.x = ((float)(lane) - 1.5f) * 1.0f; pos.z = RoadConstants.MaxRoadZ; transform.position = NumericalCurve.SnapYToCurve(pos); }
// Update is called once per frame void FixedUpdate() { Vector3 pos = transform.position / SCALE; NumericalCurve.IntegrateStep(ref pos); transform.position = pos * SCALE; if (transform.position.z < 0.01f) { transform.position = NumericalCurve.SnapYToCurve(new Vector3(0, 0, START_Z)); } }
void FixedUpdate() { if (GameObject.Find("CarKey").GetComponent <CarKey>().engineRunning) { NumericalCurve.IntegrateStep(gameObject); step++; if (step > RoadConstants.NumIntegrationSteps) { GameObject.Destroy(gameObject); } } }
// Use this for initialization void Start() { transform.position = NumericalCurve.SnapYToCurve(new Vector3(0, 0, START_Z)); }