IEnumerator TriggerStudentReactioOne() { //set mood of table2 to Middle foreach (StudentAction sa in gamePlayManager.GetComponent <MainObjectsManager>().studentsAtTable2) { sa.SetMyMood(MoodIndicator.Middle); } //Leonie looks into her box (mb41: 2.5 seconds), yield return(new WaitForSeconds(2.5f)); //then at teacher (mb14: 2.5 seconds), kidLeonie.LookAtSomeone(GameObject.FindGameObjectWithTag("Player").GetComponent <Transform>().transform); yield return(new WaitForSeconds(2.5f)); // then takes another working-sheet out of box (iwo32: working-sheet/box), // IWO32 animation is not there, so just attaching the Worksheet to the kid's hand. kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, true); yield return(new WaitForSeconds(2.0f)); //returns to her seat (ma7) kidLeonie.TurnToPlayerOrObject(false); kidLeonie.StopLookAtSomeone(); kidLeonie.GoToAndSitInChair(); yield return(new WaitForSeconds(1.0f)); kidLeonie.StopLookAtSomeone(); yield return(new WaitUntil(() => kidLeonie.studentAnimation.IsSittingNow)); kidLeonie.chairPoint.gameObject.GetComponent <ChairDetails>().ShowStudyMaterial(StudyMaterial.WorkSheet, true); yield return(new WaitForSeconds(1f)); //Leonie, as soon as returning to seat = bad --> middle kidLeonie.SetMyMood(MoodIndicator.Middle); kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, false); yield return(new WaitForSeconds(2f)); kidLeonie.StartMyRandomLookingOrWrittingAnimations(2.5f, 4f, 2.5f, 5f); yield return(new WaitForSeconds(1f)); //when starting work = middle --> good (within 3 seconds) kidLeonie.SetMyMood(MoodIndicator.Good); //as soon as Leonie sits down: //observing kids resume working(cycle of mb21 / random duration per kid: 2.5 - 4 seconds + mb33 / random duration per kid: 2.5 - 5 seconds) foreach (StudentAction sa in gamePlayManager.GetComponent <MainObjectsManager>().studentsAtTable2) { sa.StopLookAtSomeone(); sa.StopLookBetweenTwoPeopoleRoutine(); sa.StartMyRandomLookingOrWrittingAnimations(2.5f, 4f, 2.5f, 5f); //set mood back to Good sa.SetMyMood(MoodIndicator.Good); yield return(new WaitForSeconds(Random.Range(0.1f, 0.4f))); } yield return(new WaitForSeconds(6.0f)); }
IEnumerator SR4StudentWalkTowardsNewChair(StudentAction stu, int NewChairNumber) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); stu.FindMyChair("Chair", NewChairNumber); stu.GoToAndSitInChair(); }
IEnumerator StudentsBackToSeat(StudentAction stu) { stu.gameObject.SetActive(false); stu.gameObject.transform.position = stu.chairPoint.position; stu.gameObject.SetActive(true); stu.GoToAndSitInChair(); yield return(new WaitForSeconds(2f)); }
IEnumerator TeleportStudentAndBackToSeat(StudentAction stu) { stu.gameObject.SetActive(false); stu.gameObject.transform.position = classEntryPoint.position; yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 2.5f))); stu.gameObject.SetActive(true); stu.GoToAndSitInChair(); yield return(new WaitForSeconds(2f)); }
IEnumerator StudentsBackToSeat(StudentAction stu) { //stu.InitiateGoToSpot(stu.chairPoint,5f); //yield return new WaitForSeconds(5f); //stu.studentNavMesh.ResetNavigationSpeed(); stu.gameObject.SetActive(false); stu.gameObject.transform.position = stu.chairPoint.position; stu.gameObject.SetActive(true); stu.GoToAndSitInChair(); yield return(new WaitForSeconds(2f)); }
IEnumerator SR3StudentWalkTowardsFrontDesk(StudentAction stu, int val) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); stu.studentAnimation.ResetAllAnim(); stu.InitiateGoToSpot(TeacherDesk.transform); yield return(new WaitUntil((() => stu.reachedSpot))); stu.studentAnimation.TakeItem(true); yield return(new WaitForSeconds(1f)); if (val == 1) { stu.rightHandStudyMaterials.YellowPaper.SetActive(true); } else { stu.rightHandStudyMaterials.BluePaper.SetActive(true); } stu.studentAnimation.TakeItem(false); stu.GoToAndSitInChair(); yield return(new WaitForSeconds(1f)); yield return(new WaitUntil((() => stu.reachedSpot))); if (val == 1) // book yellow { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true); stu.rightHandStudyMaterials.YellowPaper.SetActive(false); } else { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().BluePaper.SetActive(true); stu.rightHandStudyMaterials.BluePaper.SetActive(false); } yield return(new WaitForSeconds(4f)); //stu.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); //stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); if (stu != KidJannik || stu != KidJannik.myNeighbourStudent) { stu.studentAnimation.MB33_WorkOnSheets(true); stu.myNeighbourStudent.studentAnimation.MB33_WorkOnSheets(true); } yield return(new WaitForSeconds(4f)); }
IEnumerator SR1WalkTowardsFrontDesk(StudentAction stu) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); stu.studentAnimation.ResetAllAnim(); stu.InitiateGoToSpot(TeacherDesk.transform); yield return(new WaitUntil((() => stu.reachedSpot))); stu.studentAnimation.TakeItem(true); yield return(new WaitForSeconds(1f)); stu.studentAnimation.TakeItem(false); stu.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, true); stu.GoToAndSitInChair(); yield return(new WaitUntil((() => stu.reachedSpot))); stu.studentAnimation.MB30_PeepToSideLeftOrRight(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 SR4StudentWalkTowardsFrontDesk(StudentAction stu, int val, float delay) { yield return(new WaitForSeconds(delay)); stu.studentAnimation.ResetAllAnim(); //walk to the Teacher's desk and stand and talk to your neighbor upon arriving //stu.InitiateGoToSpot(TeacherDesk.transform); stu.InitiateGoToSpot(TeacherDesk_outer.transform); yield return(new WaitUntil((() => stu.reachedSpot))); yield return(new WaitUntil((() => stu.myNeighbourStudent.reachedSpot))); stu.studentAnimation.MB42_StandCrossArms(true); yield return(new WaitForSeconds(3f)); stu.studentAnimation.MB42_StandCrossArms(false); //stu.studentAnimation.WalkingToStandUpIdle(true); stu.InitiateGoToSpot(TeacherDesk.transform); yield return(new WaitForSeconds(1f)); //take booklet and return to your seat //stu.studentAnimation.ResetAllAnim(); //yield return new WaitForSeconds(1f); stu.studentAnimation.TakeItem(true); yield return(new WaitForSeconds(0.2f)); if (val == 1) { stu.rightHandStudyMaterials.YellowPaper.SetActive(true); } else { stu.rightHandStudyMaterials.BluePaper.SetActive(true); } stu.studentAnimation.TakeItem(false); //stu.GoToAndSitInChair(); yield return(new WaitUntil((() => stu.reachedSpot))); if (val == 1) // book yellow { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true); stu.rightHandStudyMaterials.YellowPaper.SetActive(true); yield return(new WaitForSeconds(2f)); stu.GoToAndSitInChair(); } else { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().BluePaper.SetActive(true); stu.rightHandStudyMaterials.BluePaper.SetActive(true); yield return(new WaitForSeconds(2f)); stu.GoToAndSitInChair(); } yield return(new WaitForSeconds(1f)); //stu.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); //stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); yield return(new WaitForSeconds(2f)); if (stu != KidJannik) { stu.rightHandStudyMaterials.YellowPaper.SetActive(false); } stu.rightHandStudyMaterials.BluePaper.SetActive(false); stu.studentAnimation.MB33_WorkOnSheets(true); yield return(new WaitForSeconds(3f)); }
IEnumerator SR2StudentWalkTowardsFrontDesk(StudentAction stu, int val, bool lastStudent) { yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); stu.studentAnimation.ResetAllAnim(); stu.InitiateGoToSpot(TeacherDesk.transform); yield return(new WaitUntil((() => stu.reachedSpot))); stu.studentAnimation.TakeItem(true); yield return(new WaitForSeconds(1f)); if (val == 1) { stu.rightHandStudyMaterials.YellowPaper.SetActive(true); } else { stu.rightHandStudyMaterials.BluePaper.SetActive(true); } //stu.LookAtSomeone(stu.chairPoint); yield return(new WaitForSeconds(0.5f)); stu.GoToAndSitInChair(); yield return(new WaitForSeconds(1f)); yield return(new WaitUntil((() => stu.reachedSpot))); if (val == 1) // book yellow { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true); stu.rightHandStudyMaterials.YellowPaper.SetActive(false); } else { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().BluePaper.SetActive(true); stu.rightHandStudyMaterials.BluePaper.SetActive(false); } yield return(new WaitForSeconds(1f)); //stu.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); //stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); stu.studentAnimation.MB33_WorkOnSheets(true); stu.myNeighbourStudent.studentAnimation.MB33_WorkOnSheets(true); yield return(new WaitForSeconds(4f)); if (lastStudent == true) { //wait for last student to to be seated before showing clock yield return(new WaitForSeconds(10f)); //show 10 minute time lapse gamePlayManager.SetTimeScaleTextToMinutes(); gamePlayManager.StartTimer(true); yield return(new WaitForSeconds(10f)); gamePlayManager.StopTimer(); //move to final phase, where students with blue books become bored. StartCoroutine(SR2_FinalPhase()); } }
IEnumerator SR1StudentWalkTowardsFrontDesk(StudentAction stu, bool lastStudent) { int rand = Random.Range(1, 3); yield return(new WaitForSeconds(UnityEngine.Random.Range(0.1f, 1.5f))); //stu.studentAnimation.ResetAllAnim(); stu.InitiateGoToSpot(TeacherDesk.transform); yield return(new WaitUntil((() => stu.reachedSpot))); stu.studentAnimation.TakeItem(true); yield return(new WaitForSeconds(1f)); if (stu == KidJannik.myNeighbourStudent) { stu.rightHandStudyMaterials.YellowPaper.SetActive(true); } else { if (rand == 1) // book yellow { stu.rightHandStudyMaterials.YellowPaper.SetActive(true); } if (rand == 2) // book blue { stu.rightHandStudyMaterials.BluePaper.SetActive(true); } } stu.studentAnimation.TakeItem(false); stu.GoToAndSitInChair(); yield return(new WaitUntil((() => stu.reachedSpot))); if (stu == KidJannik.myNeighbourStudent) { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true); stu.rightHandStudyMaterials.YellowPaper.SetActive(false); } else { if (rand == 1) // book yellow { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().YellowPaper.SetActive(true); stu.rightHandStudyMaterials.YellowPaper.SetActive(false); } if (rand == 2) // book blue { stu.chairPoint.gameObject.transform.GetComponentInChildren <StudyMaterialType>().BluePaper.SetActive(true); stu.rightHandStudyMaterials.BluePaper.SetActive(false); } } yield return(new WaitForSeconds(4f)); if (rand == 1) // book yellow { stu.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.YellowPaper.transform); } if (rand == 2) // book blue { stu.LookAtSomeone(stu.rightHandStudyMaterials.BluePaper.transform); stu.myNeighbourStudent.LookAtSomeone(stu.rightHandStudyMaterials.BluePaper.transform); } yield return(new WaitForSeconds(5f)); if (lastStudent == true) { //wait for last student to to be seated before showing clock yield return(new WaitForSeconds(10f)); //show 10 minute time lapse gamePlayManager.SetTimeScaleTextToMinutes(); gamePlayManager.StartTimer(true); yield return(new WaitForSeconds(10f)); gamePlayManager.StopTimer(); } }
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)); }