using UnityEngine; public class Stopwatch : MonoBehaviour { public GameObject arrow; public AmyRunScript amy; public Quaternion arrowStartRotation; private float rotationSpeed = 360f / 60f; public bool isCounting = false; private float timeCounted = 0f; void Start() { arrowStartRotation = arrow.transform.localRotation; } void Update() { if (Lesson1Controller.Instance.activeExperiment == 0) return; if (isCounting) { arrow.transform.Rotate(0f, rotationSpeed * Time.deltaTime, 0f); timeCounted += Time.deltaTime; } if (timeCounted >= 60f && Lesson1Controller.Instance.activeExperiment == 1) ExperimentChooser.Instance.experiment2Button.interactable = true; if (Input.GetMouseButtonDown(0)) isCounting = !isCounting; if (Input.GetMouseButtonDown(1)) { arrow.transform.localRotation = arrowStartRotation; isCounting = false; if (Lesson1Controller.Instance.activeExperiment < 3) amy.PlaceOnStartAngle(); } if (Lesson1Controller.Instance.activeExperiment < 3) { if(isCounting) amy.StartRun(); else amy.StopRun(); } } }