// Update is called once per frame void Update() { if (underway) { float speed = ship.GetMovementSpeed(); distanceProgress += speed * Time.deltaTime; timeToNextBreakage = Mathf.Max(timeToNextBreakage - Time.deltaTime, 0f); if (timeToNextBreakage == 0) { itemSpawner.SpawnItemCount(1); ship.BreakDownRandomly(); SetRandomTimeToBreakage(); } } if (Input.GetKeyDown(KeyCode.F)) { itemSpawner.SpawnItemCount(1); ship.BreakDownRandomly(); } }