/// <summary> /// initializes the quiz /// randomly sets the mode and creates the necessary parts /// </summary> private void InitializeQuiz() { if (PositionToName == true) { MessageBox.Show(LocalizationManager.Instance.ResolveString("Click on the annotations and enter the name of the corresponding part"), MessageBoxType.INFORMATION); } else { MessageBox.Show(LocalizationManager.Instance.ResolveString("Connect the names with their corresponding position"), MessageBoxType.INFORMATION); transform.parent.parent.GetComponentInChildren <QuizMenuSpawner>().enabled = true; } // in both cases: create progress bar GameObject progressBarObject = (GameObject)Instantiate(Resources.Load("ProgressBar")); Transform boundingBoxHook = gameObject.transform.parent.parent.Find("MenuCenter"); CirclePositioner positioner = progressBarObject.GetComponent <CirclePositioner>(); positioner.boundingBox = boundingBoxHook; progressBar = progressBarObject.GetComponent <ProgressBar>(); badgeManager = progressBar.Badge.GetComponent <BadgeManager>(); gamificationManager.BadgeManager = badgeManager; }
// Use this for initialization void OnEnable() { GameObject menuInstance = Instantiate(WindowResources.Instance.QuizMenu); CirclePositioner positioner = menuInstance.GetComponentInChildren <CirclePositioner>(); QuizMenu menu = menuInstance.GetComponent <QuizMenu>(); menu.BoundingBox = transform.parent.gameObject; positioner.boundingBox = transform.parent; }
// Use this for initialization void Start() { GameObject menuInstance = Instantiate(WindowResources.Instance.ContextMenu); CirclePositioner positioner = menuInstance.GetComponentInChildren <CirclePositioner>(); BoundingBoxMenu menu = menuInstance.GetComponentInChildren <BoundingBoxMenu>(); menu.BoundingBox = transform.parent.gameObject; Debug.Log("Menu: " + menu.name); Debug.Log("menu.BoundingBox: " + menu.BoundingBox.name); positioner.boundingBox = transform; }