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; }
IEnumerator CardShowingStage() { taskText.text = StringRes.Get("_MotionMemorize"); yield return(timer.SimpleTimer(timeBetweenCardsShowing)); int remainingGroupSize = unsolved.Count < maxGroupSize ? unsolved.Count : maxGroupSize; for (int i = 0; i < remainingGroupSize; i++) { MemoryCard card = unsolved[GetRandom(unsolved.Count)]; BeginShowPose(card); //wait for minimum accuracy or minimum time to pass progressBar.enabled = true; yield return(timer.UITimer(cardShowingTime, progressBarMask, remainingTimeText)); progressBar.enabled = false; StopShowPose(card); tempStack.Add(card); unsolved.Remove(card); if (i < remainingGroupSize) { yield return(timer.SimpleTimer(timeBetweenCardsShowing)); } } }
protected override IEnumerator Init() { headerText.text = StringRes.Get("_RoomCalibration"); KinectDeviceManager.Instance.BeginBodyTracking(); return(base.Init()); }
void DisplayLanguageText() { header.text = StringRes.Get("_MainMenuHeader"); triviaQuizBtn.text = StringRes.Get("_TriviaQuizName"); motionMemoryBtn.text = StringRes.Get("_MotionMemoryName"); duplikBtn.text = StringRes.Get("_DuplikName"); virtualWorldBtn.text = StringRes.Get("_EnterVirtualWorld"); moCapStudioBtn.text = StringRes.Get("_MoCapStudio"); saveExitBtn.text = StringRes.Get("_SaveAndReturn"); }
protected override IEnumerator Execute() { yield return(new WaitForSeconds(1)); int cornersToConfigure = 3; Vector3[] corners = new Vector3[cornersToConfigure]; BodyDisplay.PositionCompare hRC = BodyDisplay.handRaisedCompare; for (int i = 0; i < cornersToConfigure; i++) { taskText.text = StringRes.Get("_GoToCorner"); //glow a lamp //show UI Text //leave some time for the person to raise their hand //save the position in the corners[] float remainingTime = TIMEOUT; while (remainingTime > 0f) { remainingTime -= Time.deltaTime; yield return(null); if (BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandLeft, hRC) || BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandRight, hRC) ) { Vector3 position = BodyDisplay.Instance.GetBodyPosition(); Instantiate(cornerMarker, position, Quaternion.Euler(90, 0, 0)); corners[i] = position; //Debug.Log("DetectedHandRaised! Set Corner at " + position); yield return(new WaitForSeconds(3)); //set corner at position break; } } if (remainingTime <= 0f) { Debug.LogError("Corner Configuration timed out"); yield break; } } RoomManager.Instance.CreateRoom(corners, true); yield break; }
void Start() { VirtualWorldController.Instance.FlipMainSceneControl(); GameObject canvas = GameObject.FindGameObjectWithTag("MainCanvas"); transform.SetParent(canvas.transform, false); for (int i = 0; i < buildIndizes.Length; i++) { Button btn = Instantiate(buttonPrefab); int v = i; //no idea why this is nessessary btn.onClick.AddListener(delegate { Choose(buildIndizes[v]); }); btn.gameObject.GetComponentInChildren <Text>().text = StringRes.Get(stringRes[i]); btn.transform.SetParent(transform, false); } }
protected override IEnumerator Init() { //get the required resources from the virtual world if (AppManager.useVirtualWorld) { positionController = VirtualWorldController.Instance.positionController; gras.SetActive(false); Camera cam = GameController.Instance.mainSceneCamera; gameCamera.enabled = false; mainLight.enabled = false; //Debug.Log(positionController.ToString()); Transform grasT = positionController.transform; curtain.transform.position = grasT.position + grasT.right * curtainPositionOffset.x + grasT.up * curtainPositionOffset.y + grasT.forward * curtainPositionOffset.z; Vector3 positionOffset = grasT.right * cameraPositionOffset.x + grasT.up * cameraPositionOffset.y + grasT.forward * cameraPositionOffset.z; yield return(StartCoroutine(Tween.TweenPositionAndRotation(cam.transform, grasT.position + positionOffset, grasT.rotation * cameraRotation, 3f))); } modeText.text = StringRes.Get("_DuplikLevelSeniors"); remainingTimeText.text = ""; if (Panel != null) { Panel.SetActive(true); } if (ProgressBar != null) { ProgressBar.SetActive(true); } presentGameObjects = new List <GameObject>(); grammars = GenerativeGrammatiken.Instance; sentenceArray[0] = sentence1; sentenceArray[1] = sentence2; sentenceArray[2] = sentence3; sentenceArray[3] = sentence4; sentenceArray[4] = sentence5; yield break; }
IEnumerator CardShowingStage() { taskText.text = StringRes.Get("_MotionMemorizeHouse"); yield return(timer.SimpleTimer(3f)); yield return(timer.SimpleTimer(conf.timeBetweenCardsShowing)); int remainingGroupSize = unsolved.Count < conf.maxGroupSize ? unsolved.Count : conf.maxGroupSize; for (int i = 0; i < remainingGroupSize; i++) { MemoryCardHouse card = unsolved[GetRandom(unsolved.Count)]; windowController.BeginOutline(card); windowController.BeginShowPose(card); yield return(windowController.OpenWindows(card.index, WINDOW_ANIM_TIME)); //wait for minimum accuracy or minimum time to pass progressBar.enabled = true; yield return(timer.UITimer(conf.cardShowingTime, progressBarMask, remainingTimeText)); progressBar.enabled = false; yield return(windowController.CloseWindows(card.index, WINDOW_ANIM_TIME)); windowController.StopShowPose(card); windowController.StopOutline(card); tempStack.Add(card); unsolved.Remove(card); if (i < remainingGroupSize) { yield return(timer.SimpleTimer(conf.timeBetweenCardsShowing)); } } }
/// <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) { q.Reshuffle(); InitQuestionUI(q); yield return(new WaitForSeconds(conf.questionTime)); bool correct = false; switch (conf.answeringMode) { case AnsweringMode.MOVE_X_AXIS: { Vector3 playerPosition = Vector3.zero; ToggleSlider(true); float remainingTime = conf.answerTime; countDownBar.enabled = true; countDownMask.gameObject.SetActive(true); while (remainingTime > 0f) { playerPosition = BodyDisplay.Instance.GetBodyPosition(); float adjustedX = Mathf.Clamp(playerPosition.x, -1, 1f); if (conf.flipX) { adjustedX *= -1; } adjustedX *= 0.5f; adjustedX += 0.5f; slider.value = adjustedX; remainingTime -= Time.deltaTime; countDownMask.fillAmount = 1 - remainingTime / conf.answerTime; countDownText.text = Mathf.RoundToInt(remainingTime).ToString(); yield return(null); } //yield return timer.UITimer(answerTime, countDownMask, countDownText); countDownText.text = ""; countDownBar.enabled = false; countDownMask.gameObject.SetActive(false); ToggleSlider(false); correct = (q.TrueAnswer == 0) ? playerPosition.x <= 0f : playerPosition.x > 0f; break; } case AnsweringMode.RAISE_HANDS: { float remainingTime = conf.answerTime / 2f; countDownBar.enabled = true; countDownMask.gameObject.SetActive(true); while (remainingTime > 0f) { remainingTime -= Time.deltaTime; countDownMask.fillAmount = 1 - remainingTime / conf.answerTime; countDownText.text = Mathf.RoundToInt(remainingTime).ToString(); yield return(null); } //yield return timer.UITimer(answerTime, countDownMask, countDownText); countDownText.text = ""; countDownBar.enabled = false; countDownMask.gameObject.SetActive(false); bool leftHandRaised = BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandLeft, hRC); bool rightHandRaised = BodyDisplay.Instance.JointCompare(JointId.Head, JointId.HandRight, hRC); //Debug.Log("Left" + leftHandRaised); //Debug.Log("Right" + rightHandRaised); correct = (q.TrueAnswer == 0) ? leftHandRaised && !rightHandRaised : rightHandRaised && !leftHandRaised; break; } } answerFeedback.gameObject.SetActive(true); countDownBar.gameObject.SetActive(false); countDownText.gameObject.SetActive(false); if (correct) { answerFeedback.text = StringRes.Get("_RightAnswer"); ConfettiBurst(); } else { answerFeedback.text = StringRes.Get("_WrongAnswer"); } for (int i = 0; i < q.Answers.Count; i++) { AnswerPanel p = panels[i]; if (i != q.TrueAnswer) { p.gameObject.SetActive(false); } } centerImg.gameObject.SetActive(false); yield return(new WaitForSeconds(conf.showCorrectAnswerTime)); answerFeedback.gameObject.SetActive(false); countDownBar.gameObject.SetActive(true); countDownText.gameObject.SetActive(true); }
IEnumerator CardGuessingPhase() { yield return(timer.SimpleTimer(2f)); int tempStackSize = tempStack.Count; for (int i = 0; i < tempStackSize; i++) { taskText.text = StringRes.Get("_MotionGuess"); MemoryCard card = tempStack[GetRandom(tempStack.Count)]; int maxAccuracy = 0; BeginOutline(card); float remainingTime = motionGuessingTime - timeBeforeMotionTracking; comparePercentage.text = ""; BodyDisplay.Instance.comparePercentage = 0; yield return(timer.SimpleTimer(timeBeforeMotionTracking)); Coroutine cR = StartCoroutine(BodyDisplay.Instance.BodyCompareCoroutine(card.pose.motion[0], remainingTime)); progressBar.enabled = true; while (remainingTime > 0f) { int currentAccuracy = BodyDisplay.Instance.comparePercentage; if (currentAccuracy > maxAccuracy) { maxAccuracy = currentAccuracy; } if (maxAccuracy > 95) { solved.Add(card); StopCoroutine(cR); break; } comparePercentage.text = maxAccuracy.ToString(); remainingTime -= Time.deltaTime; progressBarMask.fillAmount = 1 - remainingTime / motionGuessingTime; remainingTimeText.text = Mathf.RoundToInt(remainingTime).ToString(); yield return(null); } if (maxAccuracy > 95) { ConfettiBurst(); taskText.text = StringRes.Get("_RightAnswer"); } else { taskText.text = StringRes.Get("_WrongAnswer"); } comparePercentage.text = ""; remainingTimeText.text = ""; progressBarMask.fillAmount = 0f; progressBar.enabled = false; StopOutline(card); BeginShowPose(card); yield return(timer.SimpleTimer(cardShowingTime)); StopShowPose(card); //Debug.Log("Acc: "+ maxAccuracy); if (maxAccuracy <= 90) { unsolved.Add(card); } else { //if the card was solved, hide it card.uiElement.GetComponent <RawImage>().enabled = false; } tempStack.Remove(card); if (i < tempStackSize) { yield return(timer.SimpleTimer(timeBetweenCardsGuessing)); } } }