Example #1
0
 // Start is called before the first frame update
 /// <param name="deveTocar">Se o tutorial deve tocar obrigatóriamente.</param>
 public void PlayAndLoad(bool deveTocar)
 {
     if (PlayerPrefs.GetInt("playedStreetFighterTutorial", 0) < 1 || deveTocar)
     {
         StartCoroutine(Play());
     }
     else
     {
         sceneChanger.LoadGame(nomeCena);
     }
 }
    IEnumerator EndGame()
    {
        suspendMoveCalculation      = true;
        ShiftManagementScript.state = BattleState.END;
        AudioClip description = null;

        if (playerFighter.games == gamesToWin)
        {
            lastMove.text  = ":DDDD";
            inputText.text = "Você ganhou a luta! Parabéns!!!";
            // yield return new WaitForSeconds(1);
            // sceneChanger.LoadGame("_StreetFighter");
            description = listaSons.victoryDescription;
        }
        else if (enemyFighter.games == gamesToWin)
        {
            lastMove.text  = ":'(";
            inputText.text = "Você perdeu a luta. Mais sorte da próxima vez...";
            description    = listaSons.defeatDescription;
            // yield return new WaitForSeconds(3);
            // sceneChanger.LoadGame("_StreetFighter");
        }
        TextPlayer.instance.addToEndOfSequence(description);
        while (TextPlayer.instance.SourcesPlaying())
        {
            yield return(null);
        }
        sceneChanger.LoadGame("_SequenciaDeCombate");

        yield break;
    }
    private Button CreateButton(SceneData sceneData, Vector3 position)
    {
        // TODO Se necessário aumentar o tamanho de content
        Button b = sceneButtonFactory.make(Vector3.zero, parent.transform);

        b.transform.localPosition = position;
        Text t = b.GetComponentInChildren(typeof(Text)) as Text;

        t.text = sceneData.sceneName;

        AudioClip         ac = Resources.Load <AudioClip>(sceneData.clipPath);
        DescriptionPlayer d  = b.GetComponent(typeof(DescriptionPlayer)) as DescriptionPlayer;

        d.SetVariables(ac);

        b.onClick.AddListener(() => {
            SceneChanger c = (SceneChanger)b.gameObject.AddComponent(typeof(SceneChanger));
            c.LoadGame(sceneData.scenePath);
        });

        Debug.Log(b);
        return(b);
    }