Exemplo n.º 1
0
    public void Reset()
    {
        player.gameObject.SetActive(false);
        // Destroy Blocks with the object BlockController
        blocksArray = FindObjectsOfType <BlockController>();
        for (int i = 0; i < blocksArray.Length; i++)
        {
            Destroy(blocksArray[i].gameObject);
        }
        // Destroy Gates
        gatesArray = FindObjectsOfType <Gate>();
        for (int i = 0; i < gatesArray.Length; i++)
        {
            Destroy(gatesArray[i].gameObject);
        }

        firstBlock.transform.position = BLOCK_START_POSITION;
        player.transform.position     = PLAYER_START_POSITION;
        scoreController.Start();
        obstacleController.Start();
        player.ResetPlayer();
        player.gameObject.SetActive(true);
        deathMenu.gameObject.SetActive(false);
    }