private void CreateEmotionString(string emotionString, Vector3 position) { GameObject obj = Instantiate(Resources.Load <GameObject>("Prefab/SelectableObject/RiquadriEmozione/RiquadroEmozione"), position, Quaternion.identity, GameObject.Find("Canvas").transform); obj.GetComponent <RectTransform>().anchoredPosition = position; obj.GetComponent <TextMeshProUGUI>().text = MinigameManager.ConvertInCorrectText(emotionString); obj.transform.localScale = new Vector3(1.2f, 1.2f, 1); obj.GetComponent <SelectableObject>().enabled = false; }
protected override void SetQA(bool roundResult) { sentencesQA[0].text = MinigameManager.ConvertInCorrectText(gameManager.GetEmotionString()); if (roundResult) { SpawnFace(new Vector3(0, -2, 0), gameManager.GetComponent <MinigameManager>().GetEmotionAnswer(), gameManager.GetComponent <MinigameManager>().GetEmotionAnswer(), true, 1.4f, true); } else { SpawnFace(new Vector3(0f, -2, 0), gameManager.GetComponent <MinigameManager>().GetEmotionAnswer(), gameManager.GetComponent <MinigameManager>().GetEmotionAnswer(), false, 1.4f, true); } }
protected override void SetQA(bool roundResult) { //photoImage.sprite = Resources.Load<Sprite>("Sprite/FotoEmozioni/blablablabla" + gameManager.emotionAnswer); Questa riga setta la foto nella schermata di fine round sentencesQA[0].text = MinigameManager.ConvertInCorrectText(gameManager.GetEmotionString()); if (roundResult) { SpawnFace(new Vector3(0, -2, 0), gameManager.GetComponent <PhotographicEmotionManager>().GetEmotionAnswer(), gameManager.GetComponent <PhotographicEmotionManager>().GetEmotionAnswer(), true, 1.4f, true); } else { SpawnFace(new Vector3(0f, -2, 0), gameManager.GetComponent <PhotographicEmotionManager>().GetEmotionAnswer(), gameManager.GetComponent <PhotographicEmotionManager>().GetEmotionAnswer(), false, 1.4f, true); } }
//metodo che spawna una faccia nel gioco sopra la UI, con un certo scaling e emozioni per occhi e bocca potenzialmente diverse protected void SpawnTextUI(Vector2 position, Emotion emotion, bool correct) { GameObject textUI = Instantiate(Resources.Load <GameObject>("Prefab/ImagePrefab/RiquadroEmozioneUI"), position, Quaternion.identity); textUI.transform.SetParent(FindObjectOfType <Canvas>().transform, false); textUI.GetComponent <TextMeshProUGUI>().text = MinigameManager.ConvertInCorrectText(emotion.ToString()); Image imageComponent = textUI.transform.Find("Correct").GetComponent <Image>(); if (correct) { imageComponent.sprite = Resources.Load <Sprite>("Sprite/UI/OkIcon"); imageComponent.SetNativeSize(); } else { imageComponent.sprite = Resources.Load <Sprite>("Sprite/UI/NotOkIcon"); imageComponent.SetNativeSize(); //ChangeOpacity(textUI); } gameManager.endRoundObjectSpawned.Add(textUI); }
public void UpdateUI(MinigameManager manager) { emotionText.text = MinigameManager.ConvertInCorrectText(manager.GetEmotionString()); //fumettoText.text = fumettoPhrase.Values }
//metodo che istanzia tutti gli oggetti di cui si ha bisogno per il tutorial private void ShowTutorialEmotion(GameObject objectSelected) { //disattiva il pannello facesPanel.SetActive(false); SelectableObject sel = objectSelected.GetComponent <SelectableObject>(); Emotion emo = sel.GetEmotionType(); if (emo.ToString() != "Disgusto") { topText.text = UIEndRoundManager.ChangeTextToRandomColors("Questa e' la " + MinigameManager.ConvertInCorrectText(emo.ToString())); } else { topText.text = UIEndRoundManager.ChangeTextToRandomColors("Questo e' il " + MinigameManager.ConvertInCorrectText(emo.ToString())); } //crea tutti gli elementi CreateFace("main", emo.ToString(), new Vector3(0, -0.5f, 0), 1.5f, null, false); CreateEmotionString(emo.ToString(), new Vector3(0, -200, 0)); GameObject face1 = CreateFace("random", emo.ToString(), new Vector3(5.5f, 1f, 0), 1.2f, null, false); face1.GetComponent <Avatar>().AssignEmotion(emo); GameObject face2 = CreateFace("random", emo.ToString(), new Vector3(5.5f, -2.5f, 0), 1.2f, null, false); face2.GetComponent <Avatar>().AssignEmotion(emo); CreatePhoto(emo.ToString()); }