Пример #1
0
    public void LoadLevel(int id)
    {
        // Destroys the previous level
        if (currentLevel != null)
        {
            currentLevel.GetComponent <GameBoard>().DestroyBoard();
            succesSound.Play();
        }

        // Create the new level
        currentLevel = Instantiate(levels[id]);
        currentLevel.transform.SetParent(transform, false);
        currentLevel.GetComponent <Animator>().SetBool("showBoard", true);
        GameBoard gameBoard = currentLevel.GetComponent <GameBoard>();

        levelDescription.ShowDescription(gameBoard.title, gameBoard.subtitle);

        followingCameras = currentLevel.GetComponentsInChildren <FollowingCamera>();

        foreach (FollowingCamera followingCamera in followingCameras)
        {
            followingCamera.toFollow = toFollow;
        }
    }