public void SetupHint(InfoSign.SignType signType) { ex.SetActive(true); tired.SetActive(false); bye.SetActive(false); //hint.sprite = hintSprites[ (int)signType ]; text.gameObject.SetActive(true); Answer.SetupText(signType, oryorLogo, text); }
public void Setup(InfoSign.SignType signType) { this.signType = signType; SetupText(signType, oryorLogo, text); isActive = true; GetComponent <Animator>().SetBool("Open", true); }
public static string generateAnswerCode(InfoSign.SignType signType) { if (signType == InfoSign.SignType.Food) { var arr = new string[5]; arr[0] = getNum(10, 87); arr[1] = getNum(1, 4); arr[2] = getNum(digits.three) + getNum(50, 58); arr[3] = getNum(1, 2); arr[4] = getNum(digits.four); return(string.Join("-", arr)); } else if (signType == InfoSign.SignType.Drug) { var midText = "A<space=0.5>"; var ranTextNum = getNum(1, 3); if (ranTextNum == "2") { midText = "B<space=0.5>"; } else if (ranTextNum == "3") { midText = "C<space=0.5>"; } return(getNum(1, 2) + midText + getNum(0, 999) + "/" + getNum(50, 58)); } else if (signType == InfoSign.SignType.Cosmatic) { var arr = new string[4]; arr[0] = getNum(10, 87); arr[1] = getNum(1, 3); arr[2] = getNum(50, 58); arr[3] = getNum(digits.five); return(string.Join("-", arr)); } else if (signType == InfoSign.SignType.Medical) { var initial = "ผ<space=0.5>"; var ranText = getNum(1, 2); if (ranText == "2") { initial = "น<space=0.5>"; } return(initial + " " + getNum(1, 999) + " / " + getNum(2550, 2558)); } else if (signType == InfoSign.SignType.Dangerous) { return("วอส<space=0.5>" + " " + getNum(1, 999) + " / " + getNum(2550, 2558)); } return(string.Empty); }
public bool AnswerCurrentQuestion(InfoSign.SignType signType, Vector3 pos) { if (IsCorrect(signType)) { answerLeft--; if (answerLeft == 0) { correctAnswer(); } return(true); } else { wrongAnswer(pos); return(false); } }
public void ChangeLevel(int levelNumber, InfoSign.SignType signType) { if (!isActivate) { return; } if (levelNumber < byeLevel) { bubble.SetupHint(signType); bubble.Show(); } else { isActivate = false; StartCoroutine(byeCoroutine()); } }
private IEnumerator generateQuestion() { State = QuestionState.GenerateQuestion; currentQuestionType = (InfoSign.SignType)Random.Range(0, 5); setupActivateAnswer(getTotalAnswer(currentLevel)); Shuffle(activateAnswerList); var correctAnswer = answerLeft = getCorrectAnswer(currentLevel); startTime = timeLeft = getTimeToAnswer(currentLevel); infoSign.SwitchSign(currentQuestionType); cat.ChangeLevel(currentLevel, currentQuestionType); foreach (var answer in activateAnswerList) { if (correctAnswer > 0) { answer.Setup(currentQuestionType); correctAnswer--; } else { var randomAnswerType = (InfoSign.SignType)Random.Range(0, 5); while (randomAnswerType == currentQuestionType) { randomAnswerType = (InfoSign.SignType)Random.Range(0, 5); } answer.Setup(randomAnswerType); } } MainSoundSrc.PlaySound("Signchange2"); while (State != QuestionState.GenerateQuestion) { yield return(null); } State = QuestionState.WaitingForAnswer; }
public static void SetupText(InfoSign.SignType signType, GameObject oryorLogo, TMPro.TextMeshPro text) { if (signType == InfoSign.SignType.Drug || signType == InfoSign.SignType.Cosmatic) { oryorLogo.SetActive(false); text.fontSize = 4.5f; } else if (signType == InfoSign.SignType.Food) { oryorLogo.SetActive(true); text.fontSize = 2.5f; } else { oryorLogo.SetActive(true); text.fontSize = 3.5f; } text.text = generateAnswerCode(signType); }
public bool IsCorrect(InfoSign.SignType signType) { return(signType == currentQuestionType); }