/// <summary> /// Instantiates Speed Effect Prefab /// </summary> /// <param name="speedyType">Speedy type.</param> public void ShowSpeedyEffect(QuestionSystemEnums.SpeedyType speedyType) { switch (speedyType) { case QuestionSystemEnums.SpeedyType.Awesome: speedyEffect = SystemResourceController.Instance.LoadPrefab("AwesomeEffect", SystemPopupController.Instance.popUp); speedyEffect.GetComponent <Text>().text = "AWESOME!!"; SystemSoundController.Instance.PlaySFX("SFX_Awesome"); break; case QuestionSystemEnums.SpeedyType.Good: speedyEffect = SystemResourceController.Instance.LoadPrefab("AwesomeEffect", SystemPopupController.Instance.popUp); speedyEffect.GetComponent <Text>().text = "GOOD"; SystemSoundController.Instance.PlaySFX("SFX_correct"); break; case QuestionSystemEnums.SpeedyType.Rotten: speedyEffect = SystemResourceController.Instance.LoadPrefab("RottenEffect", SystemPopupController.Instance.popUp); speedyEffect.GetComponent <Text>().text = "NOT BAD"; SystemSoundController.Instance.PlaySFX("SFX_rotten"); break; } speedyEffect.transform.position = Vector3.zero; if (speedyType.Equals(QuestionSystemEnums.SpeedyType.Awesome)) { TweenFacade.TweenScaleToLarge(speedyEffect.transform, Vector3.one, 1.0f); } }
public void ShowClue() { GameObject clueObject = SystemResourceController.Instance.LoadPrefab("CluePrefab", clueList); TweenFacade.TweenScaleToLarge(clueObject.transform, Vector3.one, 0.3f); clueObject.GetComponentInChildren <Text>().text = clues[clueNumber - 1]; clueNumber++; if (clueNumber > clueNumberLimit) { CancelInvoke(); } }
public IEnumerator StartQuestionTimer(Action <float> action, float timer) { timeLeft = timer; float timeInterval = 0.1f; while (timeLeft > -0.1) { if (isTimerOn) { timeLeft -= timeInterval; timeLeft = Mathf.Round((float)timeLeft * 10f) / 10f; TweenFacade.SliderTimer(questionSystemController.timerSlider, timeLeft); if ((timeLeft % 1) == 0) { hintInterval--; if (hintInterval == 0) { questionSystemController.questionHint.OnClick(); questionSystemController.hintInterval.SetActive(false); hintInterval = 5; } if (hintInterval <= 3) { questionSystemController.hintInterval.SetActive(true); GameObject hintTimer = SystemResourceController.Instance.LoadPrefab("Input-UI", SystemPopupController.Instance.popUp); hintTimer.GetComponent <Image> ().enabled = false; hintTimer.transform.position = new Vector2(questionSystemController.hintInterval.transform.transform.position.x + 0.45f, questionSystemController.hintInterval.transform.transform.position.y); hintTimer.GetComponentInChildren <Text> ().text = "" + hintInterval; TweenFacade.TweenScaleToLarge(hintTimer.transform, Vector3.one, 0.5f); MonoBehaviour.Destroy(hintTimer, 0.5f); } timePassed++; action(timeLeft); if (timeLeft <= 1) { QuestionSystemController.Instance.timerSlider.fillRect.GetComponent <Image>().color = new Color32(255, 100, 100, 255); QuestionSystemController.Instance.hasNextQuestion = false; } } } if (questionSystemController.isQuestionRoundOver) { yield break; } else { yield return(new WaitForSeconds(timeInterval)); } } }
public void ShowGestureButtons(Transform button) { if (!gestureButtonContainer.activeInHierarchy) { gestureButtonContainer.SetActive(true); TweenFacade.TweenScaleToLarge(gestureButtonContainer.transform, new Vector3(1, 1, 1), 0.4f); button.gameObject.GetComponent <Image> ().sprite = closeImage; } else { button.gameObject.GetComponent <Image> ().sprite = gestureImage; Invoke("ScaleToSmall", 0.05f); } }
public void ShowSelectionHint(int hintIndex, GameObject correctAnswerContainer) { ShowAnswer showAnswer = QuestionSystemController.Instance.partAnswer.showAnswer; List <int> selectionIndex = new List <int>(); for (int i = 0; i < showAnswer.hintContainers.Count; i++) { if (showAnswer.hintContainers[i].GetComponent <Button>().interactable) { selectionIndex.Add(i); } } // selectionIndex = ListShuffleUtility.Shuffle (selectionIndex); TweenFacade.TweenScaleToLarge(showAnswer.hintContainers[selectionIndex[0]].transform, Vector3.one, 0.3f); showAnswer.hintContainers[selectionIndex[0]].GetComponent <Button> ().interactable = false; showAnswer.hintContainers [selectionIndex [0]].GetComponentInChildren <Text> ().text = letterArray [selectionIndex [0]].ToString(); }
/// <summary> /// This Method is to be activated by ChangeOrderEvent: OnSelectionEndDrag /// Sends the written answer and correct answer to the NoAnswer-AnswerType for checking /// PartAnswer -> NoAnswer AnswerType: The Answer Part is hidden with this AnswerType /// </summary> // public void OnChangeOrder public void OnChangeOrder() { if (GetSelectedAnswer().Equals(questionAnswer)) { selectionViewContent.GetComponent <HorizontalLayoutGroup> ().enabled = false; showAnswerPrefab = SystemResourceController.Instance.LoadPrefab("CluePrefab", selectionViewContent); showAnswerPrefab.transform.position = transform.position; showAnswerPrefab.GetComponent <RectTransform> ().sizeDelta = new Vector2(600, 125); showAnswerPrefab.GetComponentInChildren <Text> ().text = questionAnswer; TweenFacade.TweenScaleToLarge(showAnswerPrefab.transform, Vector3.one, 0.3f); for (int i = 0; i < selectionContainers.Length; i++) { TweenFacade.TweenMoveTo(selectionContainers [i].transform, showAnswerPrefab.transform.localPosition, 1.0f); } QuestionSystemController.Instance.CheckAnswer(true); } }
public void InitQuestionSystem() { questionList = QuestionBuilder.GetQuestionList(10, questionTypeModel); CancelInvoke(); currentQuestionNumber = 0; isQuestionRoundOver = false; if (questionList.Count > 0) { hasNextQuestion = true; } scrollHeaderPos = new Vector2(0, scrollHeader.transform.localPosition.y); scrollHeader.transform.localPosition = new Vector2(0, 240); targetTypeUI.text = questionList [0].questionType.questionCategory.ToString(); partTarget.ChangeTargetColor(questionList [0].questionType.questionCategory); selectionType = questionList [currentQuestionNumber].questionType.selectionType; popUpSelectionIndicator = selectionType.ShowSelectionPopUp(); TweenFacade.TweenScaleToLarge(popUpSelectionIndicator.transform, Vector3.one, 0.3f); popUpSelectionIndicator.transform.position = Vector3.zero; QuestionUIEntry(); StartCoroutine(DebugStartQuestionCoroutine()); }
public void ShowLetterInView(GameObject selectedLetter) { if (hasInitHints) { if (selectedIndex < questionAnswer.Length) { if (hintContainers [selectedIndex].GetComponent <Button> ().interactable) { hintContainers [selectedIndex].GetComponentInChildren <Text> ().text = selectedLetter.GetComponentInChildren <Text> ().text; hintContainers [selectedIndex].GetComponentInChildren <Image> ().color = new Color32(255, 255, 255, 255); } TweenFacade.TweenScaleToLarge(hintContainers [selectedIndex].transform, Vector3.one, 0.3f); } } else { GameObject letterPrefab = SystemResourceController.Instance.LoadPrefab("Input-UI", showLetterView); letterPrefab.GetComponentInChildren <Text> ().text = selectedLetter.GetComponentInChildren <Text> ().text; TweenFacade.TweenScaleToLarge(letterPrefab.transform, Vector3.one, 0.3f); } selectedIndex++; }
public void enableHintButton() { hintButton.interactable = true; TweenFacade.TweenScaleToLarge(hintButton.transform, Vector3.one, 0.3f); }