private bool internal_HandleSelection(int selection) { PersonType type = selection == 0 ? sessionDetails.type2 : sessionDetails.type1; PersonType talkerType = selection == 0 ? sessionDetails.type1 : sessionDetails.type2; string talkerName = selection == 0 ? sessionDetails.name1 : sessionDetails.name2; WindowsVoice.getInstance().speak(talkerName, GetTypePrefix(talkerType), PhraseGenerator.getPhrase(sessionDetails.currentIndex, type)); bool correct = sessionDetails.correctAnswerIndex[sessionDetails.currentIndex++] == selection; sessionEnded = sessionDetails.currentIndex >= sessionDetails.correctAnswerIndex.Count; return(correct); }
private IEnumerator ChangeState(GameState targetState) { switch (targetState) { case GameState.Started: { SessionLogic.InitSession(); PhraseGenerator.generatePhrases(); var parent = leftCharacter.transform.parent; GameObject tempLeft; GameObject tempRight; var leftTrans = leftCharacter.transform; var rightTrans = rightCharacter.transform; if (SessionLogic.GetPersonType(0) == SessionLogic.PersonType.Male) { tempLeft = GameObject.Instantiate(malePrefab, leftTrans.position, leftTrans.rotation, parent); tempLeft.transform.localScale = new Vector3(tempLeft.transform.localScale.x * -1, tempLeft.transform.localScale.y, tempLeft.transform.localScale.z); } else tempLeft = GameObject.Instantiate(femalePrefab, leftTrans.position, leftTrans.rotation, parent); if (SessionLogic.GetPersonType(1) == SessionLogic.PersonType.Male) tempRight = GameObject.Instantiate(malePrefab, rightTrans.position, rightTrans.rotation, parent); else { tempRight = GameObject.Instantiate(femalePrefab, rightTrans.position, rightTrans.rotation, parent); tempRight.transform.localScale = new Vector3(tempRight.transform.localScale.x * -1, tempRight.transform.localScale.y, tempRight.transform.localScale.z); } Destroy(leftCharacter.gameObject); Destroy(rightCharacter.gameObject); yield return null; leftCharacter = tempLeft.GetComponent<CharacterControllerGGJ>(); rightCharacter = tempRight.GetComponent<CharacterControllerGGJ>(); leftPlayButton = leftCharacter.playButton; rightPlayButton = rightCharacter.playButton; leftCharacter.index = 0; rightCharacter.index = 1; if (leftCharacter == null || rightCharacter == null) Debug.Log("no component"); cameraController.FadeInCamera(); yield return new WaitForSeconds(1); gameState = targetState; break; } case GameState.StartPlaySession: { gameState = GameState.PlaySessionStarted; WindowsVoice.getInstance().speak("You", SessionLogic.GetDoctorPrefix(), PhraseGenerator.getPhrase("DoctorStart")); yield return new WaitForSeconds(DoctorSpeechWaitTime); leftPlayButton.GetComponent<Animator>().SetTrigger("appear"); rightPlayButton.GetComponent<Animator>().SetTrigger("appear"); gameState = GameState.PlaySessionRunning; break; } case GameState.PlaySessionEnded: { WindowsVoice.getInstance().speak("You", SessionLogic.GetDoctorPrefix(), PhraseGenerator.getPhrase("DoctorEnd")); yield return new WaitForSeconds(DoctorSpeechWaitTime); cameraController.FadeOutCamera(); yield return new WaitForSeconds(1); playButton.SetActive(true); subtitle.text = ""; gameState = targetState; break; } default: break; } }