public void OnAnswerClick(Button answerButton) { SystemSoundController.Instance.PlaySFX("SFX_ClickButton"); if (answerButton.transform.childCount == 0) { TweenFacade.TweenShakePosition(answerButton.transform, 0.5f, 15.0f, 50, 90f); } else { if (answerButton.transform.GetChild(0).GetComponent <Button> ().interactable) { Destroy(answerButton.transform.GetChild(0).gameObject); CheckAnswerHolder(); } } }
/// <summary> /// Increases the current QuestionNumber /// /// </summary> /// <param name="isCorrect">If set to <c>true</c> is correct.</param> public void CheckAnswer(bool isCorrect) { idealTime = questionList [currentQuestionNumber].idealTime; if (isCorrect) { QuestionSystemEnums.SpeedyType speedyType = questionRoundTimer.GetSpeedyType(idealTime); ShowSpeedyEffect(speedyType); onQuestionResult(new QuestionResultModel(00000, 13, 3, isCorrect, speedyType)); QuestionFinish(); questionHint.hasHintAvailable = false; Invoke("NextQuestion", 1f); } else { SystemSoundController.Instance.PlaySFX("SFX_mistake"); TweenFacade.TweenShakePosition(gameObject.transform, 1.0f, 30.0f, 50, 90f); } }
public void ShowCorrectAnswer(bool isAnswerCorrect) { Color answerColor = new Color(); if (isAnswerCorrect) { answerColor = new Color32(255, 223, 0, 255); } else { answerColor = new Color32(255, 100, 100, 255); } for (int i = 0; i < answerClicked.Count; i++) { answerClicked [i].GetComponent <Image> ().color = answerColor; if (!isAnswerCorrect) { TweenFacade.TweenShakePosition(answerClicked [i].transform, 0.3f, 30.0f, 90, 90f); } } }
public void SelectionLetterGot(GameObject selectedObject) { CheckAnswerHolder(); if (string.IsNullOrEmpty(selectedObject.GetComponentInChildren <Text> ().text)) { TweenFacade.TweenShakePosition(selectedObject.transform, 1.0f, 30.0f, 50, 90f); } else { if (!isFull) { GameObject container = SystemResourceController.Instance.LoadPrefab("Input-UI", answerContainers [answerIndex]); selectionIdentifier [answerIndex] = selectedObject.gameObject; hintIndexRandomList.Add(answerIndex); container.GetComponentInChildren <Text> ().color = new Color32(0, 0, 0, 255); container.GetComponentInChildren <Text> ().text = selectedObject.GetComponentInChildren <Text> ().text; container.GetComponent <Image> ().raycastTarget = false; CheckAnswer(); } } }