How can add "Warm up" in unity 2d game? [closed]

I want add "Warmup" to my game like Counter strike Warmup. example Start the game after 30 seconds but player can move and testing game. How can do that?

I use this cod, i want that after 30 sec game start and there is not timer anymore in the game.

How can i do?

{
public GameObject textDisplay;
public int SecountLeft = 30;
public bool TakingAway = false;
// Start is called before the first frame update
void Start()
{
    textDisplay.GetComponent<Text>().text = "00:" + SecountLeft;

    

}

// Update is called once per frame
void Update()
{
    if (TakingAway == false && SecountLeft > 0)
    {
        StartCoroutine(TimerTake());
    }
}

IEnumerator TimerTake()
{
    TakingAway = true;
    yield return new WaitForSeconds(1);
    SecountLeft -= 1;
    if (SecountLeft < 10)
    {
        textDisplay.GetComponent<Text>().text = "00:0" + SecountLeft;
    }
    else
    {
        textDisplay.GetComponent<Text>().text = "00:" + SecountLeft;
    }
    
    TakingAway = false;

    if (SecountLeft == 0)
    {
        SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex);
    }
}

}



Read more here: https://stackoverflow.com/questions/66267178/how-can-add-warm-up-in-unity-2d-game

Content Attribution

This content was originally published by M4HDI at Recent Questions - Stack Overflow, and is syndicated here via their RSS feed. You can read the original post over there.

%d bloggers like this: