// Use this for initialization
    void Start()
    {
        gameController = GameObject.Find("Main Camera").GetComponent <GameController>();

        Time.timeScale = gameController.appTime;

        hpBar = 100f;

        gameController.vivo = true;

        level = int.Parse(SecurePlayerPrefs.GetString("nowLevel", "10", "twistninja"));

        level = 30;

        if (gameController.getSound() > 0)
        {
            musicaAtual = Mathf.FloorToInt(Random.Range(0f, 1.9f));

            objetoMusica = Instantiate(musicasFundo [musicaAtual].GetComponent <AudioSource>(), transform.position, Quaternion.identity);
        }

        spwController = objSpawner.GetComponent <SpawnerController>();

        //preFabAtual = prefabBalaoJunto;

        preFabAtual = StaticLevelFactory.getPrefabLevel(level);
        spwController.DisInstance   = StaticLevelFactory.getDistanceLevel(level);
        spwController.isPlayerBased = StaticLevelFactory.getPlayerBasedLevel(level);
        spwController.movBallon     = StaticLevelFactory.getMovLevel(level);
        spwController.isMoving      = StaticLevelFactory.getIsMovingLevel(level);
        maxSpawnCount = StaticLevelFactory.getMaxSpawnLevel(level);

        showChapterLevel();
        playGame();
    }
    IEnumerator MudaInstanciado()
    {
//		Debug.Log (StaticLevelFactory.getWaitForLevel(level));


        yield return(new WaitForSeconds(StaticLevelFactory.getWaitForLevel(level)));

        chamaCheese = true;

        level++;
        if (level > StaticLevelFactory.getMaxLevelForNumber(level))
        {
            level = StaticLevelFactory.getNextLevelForNumber(level);
            yield return(new WaitForSeconds(2));

            showChapterLevel();
        }
        SecurePlayerPrefs.SetString("nowLevel", level.ToString(), "twistninja");
        PlayerPrefs.Save();

        preFabAtual = StaticLevelFactory.getPrefabLevel(level);
        spwController.DisInstance   = StaticLevelFactory.getDistanceLevel(level);
        spwController.isPlayerBased = StaticLevelFactory.getPlayerBasedLevel(level);
        spwController.movBallon     = StaticLevelFactory.getMovLevel(level);
        spwController.isMoving      = StaticLevelFactory.getIsMovingLevel(level);
        maxSpawnCount = StaticLevelFactory.getMaxSpawnLevel(level);

        playGame();
    }