IEnumerator SR4StudentWalkTowardsNewChair(StudentAction stu, int NewChairNumber) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); stu.FindMyChair("Chair", NewChairNumber); stu.GoToAndSitInChair(); }
IEnumerator TriggerStudentReactionThree() { //Student mumbling low audioInClass.volume = 0.1f; audioInClass.Play(); KidHanna.FindMyChair("Chair", ChairNoLena); KidLena.FindMyChair("Chair", ChairNoHanna); KidHanna.FindMyNeighbour(); KidLena.FindMyNeighbour(); KidJannik.FindMyNeighbour(); KidJannik.myNeighbourStudent = KidHanna; for (int i = 0; i < gamePlayManager.studentsActions.Count; i++) { gamePlayManager.studentsActions[i].StopLookAtSomeone(); gamePlayManager.studentsActions[i].StopMyRandomLookingAnimations(); gamePlayManager.studentsActions[i].studentAnimation.ResetAllAnim(); gamePlayManager.studentsActions[i].SetMyMood(MoodIndicator.Good); } yield return(new WaitForSeconds(1.0f)); for (int i = 0; i < SR2StudentsInPair_1.Length; i++) { StartCoroutine(SR3StudentWalkTowardsFrontDesk(SR2StudentsInPair_1[i], 1)); // sit in different seats .. add this } for (int i = 0; i < SR2StudentsInPair_2.Length; i++) { StartCoroutine(SR3StudentWalkTowardsFrontDesk(SR2StudentsInPair_2[i], 2)); } //Student mumbling middle audioInClass.volume = 0.3f; audioInClass.Play(); yield return(new WaitForSeconds(18.0f)); GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().LookToPlace(true, tableFourPoint); KidJannik.studentAnimation.MB33_WorkOnSheets(false); KidJannik.myNeighbourStudent.studentAnimation.MB33_WorkOnSheets(false); KidJannik.SetMyMood(MoodIndicator.Bad); KidJannik.myNeighbourStudent.SetMyMood(MoodIndicator.Bad); KidJannik.studentAnimation.MB9_LookAround(true); KidJannik.myNeighbourStudent.studentAnimation.MB9_LookAround(true); yield return(new WaitForSeconds(4.0f)); KidJannik.studentAnimation.MB33_WorkOnSheets(true); KidJannik.myNeighbourStudent.studentAnimation.MB33_WorkOnSheets(true); }
IEnumerator TriggerStudentReactionFour() { //set student mumbling to medium audioInClass.volume = 0.03f; audioInClass.Play(); //enable player to look around and move to support seeing all kids during SRs. GameObject.FindGameObjectWithTag("Player").GetComponent <RigidbodyFirstPersonController>().MoveAndLookLocked = false; for (int i = 0; i < gamePlayManager.studentsActions.Count; i++) { gamePlayManager.studentsActions[i].StopLookAtSomeone(); gamePlayManager.studentsActions[i].StopMyRandomLookingAnimations(); gamePlayManager.studentsActions[i].studentAnimation.ResetAllAnim(); } KidMaxim.FindMyChair("Chair", 15); yield return(new WaitForSeconds(1.0f)); KidMaxim.GoToAndSitInChair(); for (int i = 0; i < mainObjectManager.studentsAtTable1.Count; i++) { mainObjectManager.studentsAtTable1[i].studentAnimation.VI7_TalkToFriendsLeftAndRight(); //StartCoroutine(StudentMoodWithDelay(mainObjectManager.studentsAtTable1[i], MoodIndicator.Middle,5f) ); } //set student mumbling to high audioInClass.volume = 0.08f; audioInClass.Play(); for (int i = 0; i < mainObjectManager.studentsAtTable2.Count; i++) { mainObjectManager.studentsAtTable2[i].studentAnimation.MB33_WorkOnSheets(true); yield return(new WaitForSeconds(0.5f)); //StartCoroutine(StudentMoodWithDelay(mainObjectManager.studentsAtTable2[i], MoodIndicator.Bad, 5f)); } for (int i = 0; i < mainObjectManager.studentsAtTable3.Count; i++) { mainObjectManager.studentsAtTable3[i].studentAnimation.MB33_WorkOnSheets(true); yield return(new WaitForSeconds(0.5f)); //StartCoroutine(StudentMoodWithDelay(mainObjectManager.studentsAtTable3[i], MoodIndicator.Middle, 10f)); } for (int i = 0; i < mainObjectManager.studentsAtTable4.Count; i++) { mainObjectManager.studentsAtTable4[i].studentAnimation.MB33_WorkOnSheets(true); yield return(new WaitForSeconds(0.5f)); //StartCoroutine(StudentMoodWithDelay(mainObjectManager.studentsAtTable4[i], MoodIndicator.Middle, 10f)); } yield return(new WaitForSeconds(1.0f)); //audioInClass.volume = 0.05f; //yield return new WaitForSeconds(6.0f); //audioInClass.volume = 0.08f; //yield return new WaitUntil((() => KidMaxim.reachedSpot)); KidMaxim.SetMyMood(MoodIndicator.Good); KidMaxim.studentAnimation.ResetAllAnim(); KidMaxim.studentAnimation.VI7_TalkToFriendsLeftAndRight(); for (int i = 0; i < mainObjectManager.studentsAtTable1.Count; i++) { mainObjectManager.studentsAtTable1[i].SetMyMood(MoodIndicator.Middle); } //audioInClass.volume = 0.08f; yield return(new WaitForSeconds(3.0f)); audioInClass.volume = 0.14f; for (int i = 0; i < mainObjectManager.studentsAtTable1.Count; i++) { mainObjectManager.studentsAtTable1[i].SetMyMood(MoodIndicator.Bad); } //nearby students get upset at the increased noise for (int i = 0; i < mainObjectManager.studentsAtTable2.Count; i++) { mainObjectManager.studentsAtTable2[i].SetMyMood(MoodIndicator.Middle); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 0.9f))); mainObjectManager.studentsAtTable2[i].SetMyMood(MoodIndicator.Bad); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); StartCoroutine(GetUpset(mainObjectManager.studentsAtTable2[i])); } for (int i = 0; i < mainObjectManager.studentsAtTable3.Count; i++) { mainObjectManager.studentsAtTable3[i].SetMyMood(MoodIndicator.Middle); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 0.9f))); mainObjectManager.studentsAtTable3[i].SetMyMood(MoodIndicator.Bad); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); StartCoroutine(GetUpset(mainObjectManager.studentsAtTable3[i])); } for (int i = 0; i < mainObjectManager.studentsAtTable4.Count; i++) { mainObjectManager.studentsAtTable4[i].SetMyMood(MoodIndicator.Middle); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 0.9f))); mainObjectManager.studentsAtTable4[i].SetMyMood(MoodIndicator.Bad); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); StartCoroutine(GetUpset(mainObjectManager.studentsAtTable4[i])); } //GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>().MovePlayer(true, mainObjectManager.Table1MoveToPoint); //GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>().LookToPlace(true, mainObjectManager.Table1); }
IEnumerator TriggerSRInitialActions() { // move Player to their original position and turn towards original rotation. GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().LookToPlayer(true, gamePlayManager.GetComponent <MainObjectsManager>().Table4); GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().MovePlayer(true, gamePlayManager.GetComponent <MainObjectsManager>().TeacherInFrontOfClassPoint); /* * for (int i = 0; i < gamePlayManager.studentsActions.Count; i++) * { * gamePlayManager.studentsActions[i].studentAnimation.ResetCurrentAnim(); * if (gamePlayManager.studentsActions[i] != kidJannik && gamePlayManager.studentsActions[i] != kidMaxim) gamePlayManager.studentsActions[i].SetMyMood(MoodIndicator.Good); * gamePlayManager.studentsActions[i].StopMyRandomLookingAnimations(); * } */ kidJannik.StopLookAtSomeone(); kidMaxim.StopLookAtSomeone(); kidJannik.FindMyChair("Chair", jannikOriginalChairNumber); kidMaxim.FindMyChair("Chair", maximOriginalChairNumber); kidJannik.GoToAndSitInChair(); kidMaxim.GoToAndSitInChair(); kidJannik.studentAnimation.WalkingToStandUpIdle(false); kidMaxim.studentAnimation.WalkingToStandUpIdle(false); jannikNewChair.ShowStudyMaterial(StudyMaterial.PencilBox, false); jannikNewChair.ShowStudyMaterial(StudyMaterial.WorkSheet, false); jannikNewChair.ShowStudyMaterial(StudyMaterial.Book, false); maximNewChair.ShowStudyMaterial(StudyMaterial.PencilBox, false); maximNewChair.ShowStudyMaterial(StudyMaterial.WorkSheet, false); maximNewChair.ShowStudyMaterial(StudyMaterial.Book, false); jannikAndMaximSat = false; StartCoroutine(TriggerCheckJannikAndMaximSat()); yield return(new WaitUntil(() => jannikAndMaximSat)); jannikOriginalChair.ShowStudyMaterial(StudyMaterial.PencilBox); jannikOriginalChair.ShowStudyMaterial(StudyMaterial.WorkSheet); jannikOriginalChair.ShowStudyMaterial(StudyMaterial.Book); maximOriginalChair.ShowStudyMaterial(StudyMaterial.PencilBox); maximOriginalChair.ShowStudyMaterial(StudyMaterial.WorkSheet); maximOriginalChair.ShowStudyMaterial(StudyMaterial.Book); //yield return new WaitForSeconds(1f); kidJannik.studentAnimation.MB26_FoldHands(true); kidMaxim.studentAnimation.MB26_FoldHands(true); kidJannik.LookAtSomeone(kidMaxim.transform); kidMaxim.LookAtSomeone(kidJannik.transform); kidJannik.SetMyMood(MoodIndicator.Bad); kidMaxim.SetMyMood(MoodIndicator.Bad); yield return(new WaitUntil(() => !GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().isMove)); foreach (StudentAction studentAction in gamePlayManager.studentsActions) { if (studentAction != kidJannik && studentAction != kidMaxim) { studentAction.SetMyMood(MoodIndicator.Good); } studentAction.ShowMyMoodNow(true); studentAction.StartMyRandomLookingOrWrittingAnimations(); yield return(new WaitForSeconds(Random.Range(0.1f, 0.3f))); } yield return(new WaitForSeconds(0.5f)); }