using System.Collections; using System.Collections.Generic; using UnityEngine; using TMPro; using UnityEngine.UI; public class ObjectIdentification : MonoBehaviour, OptionLogic { public bool selected = false; public string titleString; public GameObject options; public string optionAText; public bool isCorrectA; public string optionBText; public bool isCorrectB; private string correctOption; private goalTimer goaltimer; public TextMeshProUGUI arrow; public TextMeshProUGUI questionmark; Outline outline; private Transform canvasObject; private Transform player; public GameObject debug; public GameObject goalManager; // Start is called before the first frame update void Start() { arrow.fontSize = 290; arrow.color = Color.yellow; questionmark.fontSize = 290; questionmark.color = Color.yellow; GameObject objectOfInteraction = transform.GetChild(0).gameObject; outline = objectOfInteraction.AddComponent(); outline.OutlineColor = Color.yellow; outline.OutlineWidth = 5f; outline.OutlineMode = Outline.Mode.OutlineAll; outline.enabled = false; canvasObject = GameObject.Find("Canvas").transform; player = Camera.main.transform; if (isCorrectA){ correctOption = "a"; } else if(isCorrectB) { correctOption = "b"; } goaltimer = transform.parent.Find("goalmanager").GetComponent(); //StartCoroutine(waiter()); } IEnumerator waiter() { //Wait for 4 seconds yield return new WaitForSecondsRealtime(4); Debug.Log("selectUnselected"); selectUnselected(); } // Update is called once per frame void Update() { canvasObject.LookAt(player); } public void onHover() { debug.GetComponent().text = "" + "hover" + ""; if (selected == false){ arrow.fontSize = 250; arrow.color = Color.yellow; questionmark.fontSize = 250; questionmark.color = Color.yellow; outline.enabled = true; outline.OutlineWidth = 6f; } } public void onHoverExit() { debug.GetComponent().text = "" + "hover exit" + ""; if (selected == false){ arrow.fontSize = 200; arrow.color = Color.yellow; questionmark.fontSize = 200; questionmark.color = Color.yellow; outline.enabled = false; outline.OutlineWidth = 5f; } } public void selectUnselected() { debug.GetComponent().text = "" + "selected" + ""; if (selected == false) { outline.OutlineWidth = 5f; arrow.fontSize = 0; questionmark.fontSize = 0; outline.OutlineColor = Color.white; selected = true; Debug.Log("options = true"); options.SetActive(true); Debug.Log(options); options.transform.Find("title").GetComponentInChildren().text = "" + titleString + ""; GameObject optionA = options.transform.Find("a").gameObject; TextMeshProUGUI optionAtextObject = optionA.transform.GetChild(0).gameObject.GetComponentInChildren(); optionAtextObject.text = optionAText; optionA.GetComponent