Ejemplo n.º 1
0
    void UpdateText()
    {
        instructionText.text = TextAssetLoader.GetCorrectTextAsset($"{textPath}{instructionIndex}").text;
        backButton.gameObject.SetActive(true);
        nextButton.gameObject.SetActive(true);

        switch (instructionIndex)
        {
        case 0:
            backButton.gameObject.SetActive(false);
            animator.Play("Idle");
            break;

        case 1:
            animator.Play("Walk");
            break;

        case 2:
            animator.Play("Hit");
            break;

        case 3:
            animator.Play("Panque");
            break;

        case 4:
            animator.Play("Dance");
            nextButton.gameObject.SetActive(false);
            break;
        }
    }
Ejemplo n.º 2
0
    // Start is called before the first frame update
    void Start()
    {
        var canvas = GameObject.Find("Canvas").transform;

        titleText       = canvas.Find("How Text").GetComponent <Text>();
        titleText.text  = TextAssetLoader.GetCorrectTextAsset("Help/Help").text;
        instructionText = canvas.Find("Instruction Text").GetComponent <Text>();
        homeButton      = canvas.Find("Return Button").GetComponent <Button>();
        backButton      = canvas.Find("Back Button").GetComponent <Button>();
        nextButton      = canvas.Find("Next Button").GetComponent <Button>();

        homeButton.onClick.AddListener(() => SceneManager.LoadScene("MainMenu"));
        backButton.onClick.AddListener(() =>
        {
            instructionIndex--;
            audioSource.Play();
            UpdateText();
        });
        nextButton.onClick.AddListener(() =>
        {
            instructionIndex++;
            audioSource.Play();
            UpdateText();
        });

        animator    = FindObjectOfType <Animator>();
        audioSource = GetComponent <AudioSource>();

        UpdateText();
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        gameMenu = new GameMenu(GameObject.Find("Game Menu").transform);
        winText  = TextAssetLoader.GetCorrectTextAsset("Game/Game").text;
        gameMenu.otherGameButton.onClick.AddListener(() => ButtonFunction(() => ChangeScene("Game")));
        gameMenu.homeButton.onClick.AddListener(() => ButtonFunction(() => ChangeScene("MainMenu")));
        gameMenu.pauseButton.onClick.AddListener(() => ButtonFunction(ShowPauseMenu));
        gameMenu.resumeButton.onClick.AddListener(() => ButtonFunction(HidePauseMenu));
        gameMenu.goHomeButton.onClick.AddListener(() => ButtonFunction(GoHome));

        barricaModel = Resources.Load <GameObject>($"{prefabObjectPath}barrica");
        panqueModel  = Resources.Load <GameObject>($"{prefabObjectPath}panque");

        spawnManager  = GameObject.Find("Spawn Manager").transform;
        alienManager  = GameObject.Find("Alien Manager").transform;
        borderManager = GameObject.Find("Border Manager").transform;

        musicManager = FindObjectOfType <MusicManager>();
        musicManager.PlayNewClip(musicManager.gameMusic);

        audioSource = GetComponent <AudioSource>();

        SetColors();
        SetAliens();
        SetPanqueLocation();
    }
Ejemplo n.º 4
0
 void SetTexts()
 {
     textJson = JsonUtility.FromJson <ConfigText>(TextAssetLoader.GetCorrectTextAsset("Menu/Configuration").text);
     languageButton.GetComponentInChildren <Text>().text = textJson.languageButton;
     controlButton.GetComponentInChildren <Text>().text  = textJson.controlsButton;
     spanishButton.GetComponentInChildren <Text>().text  = textJson.spansih;
     englishButton.GetComponentInChildren <Text>().text  = textJson.english;
     for (int i = 0; i < players.Count; i++)
     {
         players[i].text = $"{textJson.player} {i + 1}";
     }
 }
Ejemplo n.º 5
0
    // Start is called before the first frame update
    void Start()
    {
        mainMenuText = JsonUtility.FromJson <MainMenuText>(TextAssetLoader.GetCorrectTextAsset(textDirection).text);

        var panel = GameObject.Find("Canvas").transform;

        firstMenu   = new FirstMenu(panel.Find("First Menu"));
        playersMenu = new PlayersMenu(panel.Find("Players Menu"));
        credistMenu = new CredistMenu(panel.Find("Credits Menu"));
        colorMenu   = new ColorMenu(panel.Find("Color Menu"));

        clickManager = GameObject.Find("Click Manager").GetComponent <AudioSource>();

        playersMenu.howManyPlayerText.text = mainMenuText.numberOfPlayerText;
        for (int i = 0; i < playersMenu.playersButtons.Length; i++)
        {
            playersMenu.playersButtons[i].GetComponentInChildren <Text>().text = $"{i + 2}";
        }

        firstMenu.playButton.onClick.AddListener(() => ButtonFunction(ShowPlayerMenu));
        firstMenu.infoButton.onClick.AddListener(() => ButtonFunction(ShowCreditMenu));
        for (int i = 0; i < playersMenu.playersButtons.Length; i++)
        {
            int x = i + 2;
            playersMenu.playersButtons[i].onClick.AddListener(() => ButtonFunction(() => ShowColorMenu(x)));
        }
        firstMenu.configButton.onClick.AddListener(() => ButtonFunction(() => SceneManager.LoadScene("Configuration")));
        firstMenu.howButton.onClick.AddListener(() => ButtonFunction(() => SceneManager.LoadScene("Help")));
        playersMenu.returnButton.onClick.AddListener(() => ButtonFunction(ShowFirstMenu));
        credistMenu.returnButton.onClick.AddListener(() => ButtonFunction(ShowFirstMenu));
        credistMenu.malenyButton.onClick.AddListener(() => Application.OpenURL("https://www.linkedin.com/in/elena-hernández/"));
        credistMenu.pacoButton.onClick.AddListener(() => Application.OpenURL("https://www.linkedin.com/in/francisco-rovira/"));
        for (int i = 0; i < colorMenu.colorButton.Length; i++)
        {
            int x = i;
            colorMenu.colorButton[i].onClick.AddListener(() => ButtonFunction(() => SetColor(x)));
        }
        colorMenu.returnButton.onClick.AddListener(() => ButtonFunction(ReturnColorMenu));

        credistMenu.madeText.text = mainMenuText.creditsBody;
        credistMenu.andText.text  = mainMenuText.creditsSecondBody;

        musicManager = FindObjectOfType <MusicManager>();
        musicManager.PlayNewClip(musicManager.menuMusic);
    }