using System.Collections;
public class GameManager : MonoBehaviour
public GameObject gameOverMenu;
private float respawnTime;
Application.targetFrameRate = 60;
homes = FindObjectsOfType<Home>();
frogger = FindObjectOfType<Frogger>();
gameOverMenu.SetActive(false);
for (int i = 0; i < homes.Length; i++) {
homes[i].enabled = false;
StartCoroutine(Timer(30));
private IEnumerator Timer(int duration)
timeText.text = time.ToString();
yield return new WaitForSeconds(1);
timeText.text = time.ToString();
Invoke(nameof(Respawn), 1f);
Invoke(nameof(GameOver), 1f);
frogger.gameObject.SetActive(false);
gameOverMenu.SetActive(true);
StartCoroutine(CheckForPlayAgain());
private IEnumerator CheckForPlayAgain()
if (Input.GetKeyDown(KeyCode.Return)) {
public void AdvancedRow()
public void HomeOccupied()
frogger.gameObject.SetActive(false);
int bonusPoints = time * 20;
SetScore(score + bonusPoints + 50);
Invoke(nameof(NewLevel), 1f);
Invoke(nameof(Respawn), 1f);
for (int i = 0; i < homes.Length; i++)
private void SetScore(int score)
scoreText.text = score.ToString();
private void SetLives(int lives)
livesText.text = lives.ToString();