protected override IEnumerator Execute() { KinectDeviceManager.Instance.BeginBodyTracking(); memoryCanvas.SetActive(false); startScreen.SetActive(true); startScreenText.text = StringRes.Get("_GetReady"); progressBar.enabled = true; yield return(timer.UITimer(timeBeforeStart, progressBarMask, startScreenCountdown)); progressBar.enabled = false; startScreenText.text = ""; startScreen.SetActive(false); memoryCanvas.SetActive(true); BodyDisplay.Instance.OnBeginDisplay(); int remainingRounds = maximumRounds; unsolved = new List <MemoryCard>(cards); tempStack = new List <MemoryCard>(); solved = new List <MemoryCard>(); while (unsolved.Count > 0) { remainingRounds--; yield return(CardShowingStage()); taskText.text = StringRes.Get("_MotionGuess"); yield return(timer.SimpleTimer(timeBetweenShowingAndGuessing)); yield return(CardGuessingPhase()); if (remainingRounds == 0) { break; } yield return(timer.SimpleTimer(timeBetweenRounds)); } BodyDisplay.Instance.OnStopDisplay(); taskText.text = ""; memoryCanvas.SetActive(false); startScreen.SetActive(true); if (unsolved.Count <= 0) { ConfettiBurst(); } startScreenText.text = (unsolved.Count > 0) ? StringRes.Get("_NoRoundsRemaining") : StringRes.Get("_Win"); AppManager.bodyTrackingRunning = false; }
/// <summary> /// The Lamps glow for the set "glowTime" while reading the available Answers. /// The mesh filter changes from glowing to normal after the glowTime is finished. /// The User has the set time "answerTime" to think what the right answer is. /// The Lamp corresponding to the right answer glows up and the other Lamps and answers disappear (are disabled). /// </summary> /// <param name="q"></param> /// <returns></returns> IEnumerator AskQuestion(QuestionCard q) { InitQuestionUI(q); Vector3 cornerPosition = room.Corners[q.TrueAnswer]; //highlight the answers for (int i = 0; i < q.Answers.Count; i++) { GameObject bulb = panels[i].Bulb; MeshFilter mF = bulb.GetComponent <MeshFilter>(); MeshRenderer mR = bulb.GetComponent <MeshRenderer>(); mF.mesh = glowing; mR.material.SetColor(emissionId, colorsBright[i]); yield return(new WaitForSeconds(glowTime)); mR.material.SetColor(emissionId, colorsDimm[i]); mF.mesh = normal; } countDownBar.enabled = true; yield return(timer.UITimer(answerTime, countDownMask, countDownText)); Vector3 playerPosition = BodyDisplay.Instance.GetBodyPosition(); if (BodyDisplay.Instance.GetBodyBoundingBox(out Bounds b)) { if (b.IntersectXZCircle(cornerPosition, 1f)) { Debug.Log("Correct"); } } //TODO: Get the position of the player and compare it to the specified corner. countDownBar.enabled = false; for (int i = 0; i < q.Answers.Count; i++) { AnswerPanel p = panels[i]; if (i != q.TrueAnswer) { p.gameObject.SetActive(false); } else { p.Bulb.GetComponent <MeshFilter>().mesh = glowing; p.Bulb.GetComponent <MeshRenderer>().material.SetColor(emissionId, colorsBright[i]); } } yield return(new WaitForSeconds(showCorrectAnswerTime)); }
protected override IEnumerator Execute() { int remainingRounds = conf.rounds; while (remainingRounds > 0) { Panel.SetActive(true); //Debug.Log("starting Round: " + maxRounds); for (int i = 0; i < MAX_SENTENCES; i++) { PaintPicture(); sentenceArray[i].text = grammars.PrintSentence(); progressBar.enabled = true; yield return(timer.UITimer(conf.drawingTime, progressBarMask, remainingTimeText)); progressBar.enabled = false; } Panel.SetActive(false); curtain.GetComponentInChildren <CurtainOpen>().MoveCurtain(); remainingRounds--; yield return(timer.SimpleTimer(conf.showingTime)); if (remainingRounds == 0) { yield break; } curtain.GetComponentInChildren <CurtainOpen>().MoveCurtain(); foreach (TextMeshProUGUI t in sentenceArray) { t.text = ""; } //Array.Clear(sentenceArray, 0, sentenceArray.Length); //Debug.Log("waiting 10 to restart"); yield return(timer.SimpleTimer(10)); foreach (GameObject presentOb in presentGameObjects) { Destroy(presentOb); } presentGameObjects.Clear(); } }