// Update is called once per frame void Update() { if (transform.position.x <= slow && m.GetSpeed() > 0) { m.AddSpeed(Time.deltaTime * accelerator); } if (transform.position.x >= -slow && m.GetSpeed() < 0) { m.AddSpeed(Time.deltaTime * -accelerator); } }