Esempio n. 1
0
    IEnumerator TriggerMainActionThree()
    {
        yield return(new WaitForSeconds(1.0f)); // timeframe is already covered for nearly 10 seconds


        ////Leonie talks back - moved from here to MainActionTwo
        //string textToTalk = "Ich habe aber keine Lust.";
        //if (gamePlayManager.LOG_ENABLED) yield return StartCoroutine(SpeechManager.Instance.WaitForTalking(textToTalk));
        //yield return new WaitForSeconds(2.0f);


        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, false);
        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, false);
        kidLeonie.SetMyLeftHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, false);
        kidLeonie.StopLookAtSomeone();
        kidLeonie.StopMyRandomLookingAnimations();
        kidLeonie.studentAnimation.ResetAllAnim();

        kidLeonie.InitiateGoToSpot(leoniePosAtCubbyBox);
        GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().LookToPlayer(true, kidLeonie.myCubbyBoxPos.transform);
        Debug.Log("Leonie started to walk to her cubby box");
        yield return(new WaitForSeconds(4f));

        GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().MovePlayer(true, teacherPosAtCubbyBox);
        yield return(new WaitForSeconds(2f));

        GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>().LookToPlayer(true, kidLeonie.gameObject.transform);
        yield return(new WaitUntil(() => kidLeonie.reachedSpot));

        // GameObject.FindGameObjectWithTag("Player").GetComponent<PlayerMovement>().LookToPlayer(true, kidLeonie.gameObject.transform);
        yield return(new WaitForSeconds(1.5f));

        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, true);
        yield return(new WaitForSeconds(1.5f));

        if (!ripPaperAudio.isPlaying)
        {
            ripPaperAudio.Play();
        }
        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, false);

        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, true);
        kidLeonie.SetMyLeftHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, true);

        foreach (StudentAction sa in gamePlayManager.GetComponent <MainObjectsManager>().studentsAtTable2)
        {
            sa.StopLookAtSomeone();
            sa.StopMyRandomLookingAnimations();
            sa.LookAtSomeone(kidLeonie.gameObject.transform);
            yield return(new WaitForSeconds(Random.Range(0.1f, 0.4f)));
        }

        yield return(new WaitForSeconds(1.5f));

        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, false);
        kidLeonie.SetMyLeftHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, false);
        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, true);
        if (ripPaperAudio.isPlaying)
        {
            ripPaperAudio.Stop();
        }
        yield return(new WaitForSeconds(1.5f));

        if (!ripPaperAudio.isPlaying)
        {
            ripPaperAudio.Play();
        }
        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.WorkSheet, false);
        kidLeonie.SetMyRightHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, true);
        kidLeonie.SetMyLeftHandStudyMaterialsVisibilty(StudyMaterial.RippedPaper, true);

        foreach (StudentAction sa in gamePlayManager.GetComponent <MainObjectsManager>().studentsAtTable2)
        {
            sa.StopLookAtSomeone();
            sa.StartLookBetweenTwoPeopoleRoutine(GameObject.FindGameObjectWithTag("Player").transform, kidLeonie.gameObject.transform, 2f, 4f);
            yield return(new WaitForSeconds(Random.Range(0.1f, 0.4f)));
        }
        yield return(new WaitForSeconds(3f));

        Debug.Log("MA3 finished");

        //Teacher Question Panel
        StartCoroutine(TriggerTeacherQuestionPhase());
    }