Menu
CoddyTech

Recap: Round Manager

Part of the Building Real Games section of Coddy's Unity journey. Lesson 16 of 56.

challenge icon

Challenge

Easy

A coin grab in 3 rounds of 4 seconds. The arrows walk the Player (ready). Write the RoundManager and the Coin scripts; the Inspector has filled the RoundManager's fields with the panels, the texts, rounds (3) and roundTime (4).

  • The RoundManager is a singleton, so each coin reaches it with no Inspector field.
  • It has three states. Ready shows only readyPanel, with roundText naming the round (Round 1, then Round 2...), and Space starts the round. Playing shows only playPanel and lasts roundTime seconds; then the next round is Ready, or after the last round the game is Finished. Finished shows only finishedPanel, with finalText giving the coins, as Coins: 3, and nothing starts it again.
  • A coin the player touches during a round counts, shows the total in coinsText (Coins: 2) and is removed. A coin touched between rounds does not count and stays where it is.

Press Play and play all three rounds, then Check.

Try it yourself

using UnityEngine;
using TMPro;

public class RoundManager : MonoBehaviour
{
    public GameObject readyPanel;
    public GameObject playPanel;
    public GameObject finishedPanel;
    public TMP_Text roundText;
    public TMP_Text coinsText;
    public TMP_Text finalText;
    public int rounds = 3;
    public float roundTime = 4f;

    // A singleton with three states: Ready, Playing and Finished
}

All lessons in Building Real Games