// Update is called once per frame void Update() { if (Input.GetMouseButtonDown(0)) { // Play And Pause if (rect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { // Debug.Log(Input.mousePosition); //simulation has not started if (!started || finished) { TimeStep.DestroyObjects(); StartCoroutine_Auto(TimeStep.instance.ReadFile(startStep)); started = true; finished = false; } //simulation has already started else if (started && TimeStep.instance.isPaused == false) { TimeStep.instance.PauseTimeStep(); } else if (started && TimeStep.instance.isPaused == true) { TimeStep.instance.UnpauseTimeStep(); } } // Fastforward if (ffRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { if (started == true) { if (Time.timeScale < 64) { Time.timeScale *= 2; } } } // Slow if (slowRect.Contains(new Vector2(Input.mousePosition.x, Screen.height - Input.mousePosition.y))) { if (started == true) { if (Time.timeScale >= 0.5f) { Time.timeScale = Time.timeScale / 2; } } } } }