Exemple #1
0
    public void NextRound()
    {
        if (rounds.Count == 0)
        {
            Debug.Log("Error: No Rounds");
        }

        if (bombSpawn != null)
        {
            StopCoroutine(bombSpawn);
        }
        if (blockSpawn != null)
        {
            StopCoroutine(blockSpawn);
        }

        if (GameManager.instance.CheckWin())
        {
            return;
        }

        timer = 0f; // Cancels timer if still active
        UIManager.instance.UpdateTimerUI(0f);
        foreach (FriendController f in playersToRespawn)
        {
            f.Respawn();
        }
        playersToRespawn.Clear();

        RoundAbstract next = rounds.Count == 1 ? rounds[0] : currentRound;

        while (currentRound == next && rounds.Count > 1)
        {
            next = rounds[Random.Range(0, rounds.Count)];
        }
        currentRound = next;
        settings     = currentRound.settings;

        if (settings.bombSpawn)
        {
            bombSpawn = StartCoroutine(SpawnBomb());
        }
        if (settings.blockSpawn)
        {
            blockSpawn = StartCoroutine(SpawnBlock());
        }
        currentRound.StartRound();
        UIManager.instance.UpdateRoundUI(currentRound);
    }
Exemple #2
0
 public void UpdateRoundUI(RoundAbstract r)
 {
     titleText.text = r.title;
     descText.text  = r.desc;
 }