Ejemplo n.º 1
0
 protected virtual void EndSequence(bool getDestroyed = true)
 {
     runGame   = false;
     staticCam = false;
     pauseMove = false;
     StartCoroutine(TasklistScript.SetTaskList(true));
     companion.GetComponent <FollowScript>().enabled = true;
     player.GetComponent <PlayerScript>().enabled    = true;
     player.GetComponent <Collider2D>().enabled      = true;
     player.GetComponent <Rigidbody2D>().simulated   = true;
     anim_player.SetTrigger("startMove");
     anim_comp.SetTrigger("startMove");
     cScript.target = player;
     cScript.offset = Vector2.up * 2;
     if (getDestroyed)
     {
         Destroy(gameObject);
     }
 }
Ejemplo n.º 2
0
    protected IEnumerator Setup()
    {
        runGame   = true;
        pauseMove = true;
        staticCam = true;
        StartCoroutine(TasklistScript.SetTaskList(false));
        StartCoroutine(cScript.SetRotation());

        player.GetComponent <PlayerScript>().enabled    = false;
        companion.GetComponent <FollowScript>().enabled = false;
        player.GetComponent <Collider2D>().enabled      = false;
        player.GetComponent <Rigidbody2D>().simulated   = false;

        anim_player = player.transform.GetChild(0).GetComponent <Animator>();
        anim_comp   = companion.transform.GetChild(0).GetComponent <Animator>();
        yield return(new WaitForSeconds(.1f));

        anim_player.SetBool("inAir", false);
        anim_comp.SetBool("inAir", false);
        anim_player.SetBool("moving", false);
        anim_comp.SetBool("moving", false);
        yield break;
    }
Ejemplo n.º 3
0
    protected override IEnumerator PlaySequence()
    {
        anim_player = player.transform.GetChild(0).GetComponent <Animator>();
        anim_comp   = companion.transform.GetChild(0).GetComponent <Animator>();

        runGame   = true;
        pauseMove = true;
        staticCam = true;
        TasklistScript.SetTaskList(false);
        cScript.target               = player;
        cScript.offset               = new Vector2(-4, 2);
        cScript.transform.position   = player.transform.position + new Vector3(0, 2, -10);
        player.transform.position    = new Vector3(-175, -2);
        companion.transform.position = new Vector3(-172, -2);
        StartCoroutine(cScript.SetRotation());

        player.GetComponent <PlayerScript>().enabled    = false;
        companion.GetComponent <FollowScript>().enabled = false;
        yield return(new WaitForSeconds(.1f));

        anim_player.SetBool("moving", false);
        anim_player.SetBool("inAir", false);


        //Saw, Hammer und Screwdriver kommen raus:
        GameObject ham         = transform.GetChild(0).gameObject;
        GameObject saw         = transform.GetChild(1).gameObject;
        GameObject screwdriver = transform.GetChild(2).gameObject;
        Animator   anim_ham    = ham.transform.GetChild(0).GetComponent <Animator>();
        Animator   anim_saw    = saw.transform.GetChild(0).GetComponent <Animator>();
        Animator   anim_screw  = screwdriver.transform.GetChild(0).GetComponent <Animator>();

        screwdriver.transform.position = new Vector3(-191.5f, -2.5f);
        screwdriver.SetActive(true);
        anim_screw.Play("toolAppear");
        yield return(new WaitForSeconds(.5f));

        StartCoroutine(MoveTool(screwdriver, -182));

        saw.transform.position = new Vector3(-191.5f, -2.5f);
        saw.SetActive(true);
        anim_saw.Play("toolAppear");
        yield return(new WaitForSeconds(.5f));

        StartCoroutine(MoveTool(saw, -185));

        if (progress.millState % 3 == 1)
        {
            ham.transform.position = new Vector3(-191.5f, -2.5f);
            ham.SetActive(true);
            anim_ham.Play("toolAppear");
            yield return(new WaitForSeconds(.5f));

            StartCoroutine(MoveTool(ham, -189));
            yield return(new WaitForSeconds(1));
        }
        else
        {
            yield return(new WaitForSeconds(1));

            anim_screw.Play("JumpScare");
            speachBubble.Say("Ist die Mühle\nwieder kaputt?", Bubbles.Normal, target: screwdriver);
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            anim_comp.Play("lookHappy");
            speachBubble.Say("Nö, wir wollten\nnur mal Hallo sagen", Bubbles.Normal, target: companion);
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            anim_screw.Play("lookAnnoyed");
            yield return(new WaitForSeconds(.1f));

            anim_saw.Play("lookAnnoyed");

            speachBubble.Say("...Du machst mir\nKongurenz!", Bubbles.Normal, target: saw);
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            anim_screw.Play("Squeesh");
            speachBubble.Say("Wir sind gerade\ndabei die Stadt\nauszubauen", Bubbles.Normal, target: screwdriver);
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            speachBubble.Say("Da haben wir leider\nnicht so viel Zeit\nzum plaudern", Bubbles.Normal, target: screwdriver);
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            yield return(new WaitForSeconds(.5f));

            StartCoroutine(MoveTool(saw, -191.5f, 1, false));
            yield return(new WaitForSeconds(.5f));

            StartCoroutine(MoveTool(screwdriver, -191.5f, 1, false));
            yield return(new WaitForSeconds(2));

            EndSequence();
            yield break;
        }



        anim_screw.Play("Squeesh");
        speachBubble.Say("Hallo, ich bin\n Schraub der\nSchraubendreher", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("...Das hier ist\ndie Säge...", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_saw.Play("smallJump");
        speachBubble.Say("...Und er ist der Hammer!", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("Squeesh");
        speachBubble.Say("Wir sind die\nGuilde der\nHandwerker", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("JumpScare");
        speachBubble.Say("Hey Moment mal!\nHaben wir nicht den\nHammer gerade eben erst\nam gebauten Haus\ngesehen?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("JumpScare");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        anim_ham.Play("lookHappy");
        speachBubble.Say("Ich bin halt\nder Hammer!", Bubbles.Normal, target: ham);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_screw.Play("lookAnnoyed");
        speachBubble.Say("Es war gerade\nMittagspause\nDa ist er besonders schnell\nwieder zurück", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookFocused");
        speachBubble.Say("Ich habe halt\neinen hammermäßigen\nHunger!", Bubbles.Normal, target: ham);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        anim_screw.Play("smallJump");
        speachBubble.Say("Ihr müsst die\nneuen Mitglieder der\nGuilde sein", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("Nur Mitglieder kennen\n das geheime\nKlopfzeichen", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("Squeesh");
        yield return(new WaitForSeconds(.75f));

        anim_comp.Play("lookInPain");
        speachBubble.Say("Ähm, so ist es!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookAnnoyed");
        player.GetComponent <VoiceScript>().PlayMumble();
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Wir haben auf\nden Weg hierhin\ngesehen das die Mühle\nzerstört ist.", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("Vielleicht sollten wir\nsie als erstes wieder\naufbauen.", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookNormal");
        anim_comp.Play("lookNormal");

        anim_screw.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_saw.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_ham.Play("JumpScare");

        speachBubble.Say("DIE MÜHLE IST\nZERSTÖRT!?", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookSad");
        speachBubble.Say("Das hört sich nach\neinem Notfall an", Bubbles.Normal, target: ham);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_saw.Play("smallJump");
        speachBubble.Say("Da müssen wir einen\nAntrag auf Erneuerung\nder Mühle stellen", Bubbles.Normal, target: saw);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_screw.Play("lookAnnoyed");
        anim_ham.Play("lookAnnoyed");
        speachBubble.Say("Ein Befunddatenblatt\nausarbeiten", Bubbles.Normal, target: saw);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookAnnoyed");
        speachBubble.Say("Ein Schadbildkatalog\nerstellen", Bubbles.Normal, target: saw);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookAnnoyed");
        speachBubble.Say("Eine...", Bubbles.Normal, target: saw, speed: .2f, autoPlay: true);
        yield return(new WaitForSeconds(1));

        anim_screw.Play("lookAngry");
        speachBubble.Say("Wie wäre es, wenn\nwir uns erstmal\ndie Mühle anschauen?", Bubbles.Normal, target: screwdriver);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_saw.Play("Squeesh");
        speachBubble.Say("Eine Bestandsaufnahme\nmachen, ja", Bubbles.Normal, target: saw);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("(Was für eine\nNervensäge...)", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_screw.Play("lookAnnoyed");
        anim_ham.Play("smallJump");
        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        anim_player.Play("lookNormal");
        speachBubble.Say("Wir treffen uns\ndann bei der Mühle", Bubbles.Normal, target: ham);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(.5f));

        StartCoroutine(MoveTool(screwdriver, -120, 5, false));
        yield return(new WaitForSeconds(.5f));

        StartCoroutine(MoveTool(saw, -120, 5, false));
        yield return(new WaitForSeconds(.5f));

        StartCoroutine(MoveTool(ham, -120, 5, false));

        yield return(new WaitForSeconds(3));


        anim_comp.Play("lookHappy");
        speachBubble.Say("Zum Glück\nhaben wir jemanden\ngefunden, der uns mit der\nMühle helfen kann", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("Jetzt können wir sie\nendlich reparieren damit\nwir das Mehl\nbekommen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookHappy");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        EndSequence();

        yield break;
    }
Ejemplo n.º 4
0
    IEnumerator RunIntroSequence()
    {
        yield return(new WaitForSeconds(.1f));

        if (pauseGame)
        {
            yield break;
        }
        staticCam = true;
        pauseMove = true;
        runGame   = true;
        cScript.transform.rotation = Quaternion.identity;

        yield return(new WaitForSeconds(.1f));

        player.GetComponent <PlayerScript>().enabled = false;
        yield return(new WaitForSeconds(.1f));

        anim        = GetComponent <Animator>();
        anim_player = player.transform.GetChild(0).GetComponent <Animator>();
        anim_comp   = companion.transform.GetChild(0).GetComponent <Animator>();
        GameObject farmer      = transform.GetChild(1).gameObject;
        Animator   anim_farmer = farmer.transform.GetChild(0).GetComponent <Animator>();

        anim_player.SetBool("inAir", false);

        //Nehme Liste raus:
        StartCoroutine(TasklistScript.SetTaskList(false));

        cScript.offset = new Vector2(0, 3);
        cScript.target = farmer;
        StartCoroutine(cScript.SetZoom(8, 2));
        StartCoroutine(cScript.SetRotation(rotTime: 2));

        anim_farmer.Play("Squeesh");
        yield return(new WaitForSeconds(1));

        anim_farmer.Play("lookAngry");
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Hey!!!\nIhr da!", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitForSeconds(.2f));

        anim_player.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_comp.Play("JumpScare");
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //player und companion bewegen sich vor den bauern:
        anim_comp.SetBool("moving", true);
        anim_comp.SetTrigger("startMove");
        StartCoroutine(MoveCompanion());

        anim_player.SetBool("moving", true);
        anim_player.SetTrigger("startMove");
        float moveSpeed = 0.05f * Mathf.Sign(235 - player.transform.position.x);

        while (Mathf.Abs(player.transform.position.x - 235) > Mathf.Abs(moveSpeed))
        {
            player.transform.position += Vector3.right * moveSpeed;
            yield return(new WaitForFixedUpdate());
        }
        anim_player.SetBool("moving", false);
        anim_comp.SetBool("moving", false);
        yield return(new WaitForSeconds(1f));

        speachBubble.Say("Habt ihr meine\nKartoffeln geklaut?", Bubbles.Shouting, target: farmer);
        anim_comp.Play("lookScared");
        anim_player.Play("lookSad");
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("Meine schöne\nKartoffelernte ist\nwie vom Erdboden\nverschluckt", Bubbles.Shouting, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookFurious");
        speachBubble.Say("Ihr habt doch\nnichts damit\nzu tun", Bubbles.Shouting, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("ODER???", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("Squeesh");
        player.GetComponent <VoiceScript>().PlayQuestion();
        yield return(new WaitForSeconds(.5f));

        anim_player.Play("lookSad");
        yield return(new WaitForSeconds(1));

        anim_farmer.Play("lookPuzzled");
        speachBubble.Say("Wie war das?\nIhr seit auch auf\nder Suche nach\nKartoffeln?", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim.Play("potatoHeist1");
        anim_farmer.Play("lookAnnoyed");
        speachBubble.Say("Nun, hier werdet\nihr keine finden!", Bubbles.Normal, target: farmer);
        speachBubble.Say("Die wenigen\nKartoffeln, die übrig\nsind reichen kaum\nnoch für mein Mittag!", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookSad");
        anim_farmer.Play("lookFocused");
        yield return(new WaitForSeconds(2));

        anim_farmer.Play("Squeesh");
        GameObject bulb = transform.GetChild(2).gameObject;

        bulb.SetActive(true);
        bulb.transform.position = farmer.transform.position + Vector3.up;
        bulb.GetComponent <Animator>().Play("Idea");
        yield return(new WaitForSeconds(1));

        bulb.SetActive(false);

        anim_farmer.Play("lookNormal");
        speachBubble.Say("Ich habe eine\nIdee!", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim.Play("potatoHeist2");
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Wenn ihr meine\nKartoffeln\nwiederfindet,", Bubbles.Normal, target: farmer);
        speachBubble.Say("Dann gebe ich\neuch ein paar\nKartoffeln ab", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.SetTrigger("blink");
        speachBubble.Say("Was haltet\nihr davon?", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("Squeesh");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        anim_comp.Play("lookPuzzled");
        speachBubble.Say("die Kartoffeln\nwurden also\ngeklaut?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.SetTrigger("blink");
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Ähm,\nja schon...", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //Verkleide den Spieler und dessen Companion zu Detektive:
        Transform parent_companionAcc = companion.transform.GetChild(0).GetChild(0).GetChild(0);

        manager.ChangeClothes(accessoirSets[0], accessoirSets[1]);
        yield return(new WaitForSeconds(2.25f));

        //Füge Wasserpfeife- Blubberblasen hinzu:
        Instantiate(pipeBubbles, parent_companionAcc.GetChild(1)).transform.localPosition = new Vector3(.5f, -.5f);

        anim_comp.Play("lookFocused");
        speachBubble.Say("Gehe ich recht in\nder Annahme, dass Sie uns\nals Privatdetektive\nanheuern wollen?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.SetTrigger("Blink");
        yield return(new WaitForSeconds(.2f));

        anim_farmer.SetTrigger("blink");
        speachBubble.Say("...Bitte was?", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookPuzzled");
        yield return(new WaitForSeconds(1));

        speachBubble.Say("...Der Fall ist schwer,\naber wir sind die besten\nauf unserem Gebiet", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookHappy");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Wir kümmern uns darum!", Bubbles.Normal, target: companion);
        speachBubble.Say("Betrachten sie\nden Fall als so gut\nwie gelöst.", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.SetTrigger("blink");
        yield return(new WaitForSeconds(.2f));

        anim_farmer.SetTrigger("blink");
        yield return(new WaitForSeconds(.2f));

        anim_farmer.SetTrigger("blink");
        speachBubble.Say("...Nun, falls ihr die\nKartoffeln findet\ndann bringt sie mir\nbitte zum Lagerhaus", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //Player und Companion bewegen sich weg:
        cScript.target   = player;
        cScript.offset   = Vector2.up * 2;
        cScript.strength = .05f;

        player.transform.localScale    = new Vector3(-1, 1, 1);
        companion.transform.localScale = new Vector3(-1, 1, 1);
        Vector3 step = Vector3.left * .05f;

        anim_player.SetBool("moving", true);
        anim_player.SetTrigger("startMove");
        anim_comp.SetBool("moving", true);
        anim_comp.SetTrigger("startMove");
        for (float count = 0; count < 4; count += Time.fixedDeltaTime)
        {
            player.transform.position    += step;
            companion.transform.position += step;
            yield return(new WaitForFixedUpdate());
        }
        anim_player.SetBool("moving", false);

        yield return(new WaitForSeconds(1));

        anim_comp.Play("lookFocused");
        speachBubble.Say("...Hhhmmm...\nalle Spuren verlaufen\nim Sand.", Bubbles.Normal, target: companion);
        speachBubble.Say("Ich schätze,\nda müssen wir etwas\ntiefer graben", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("Squeesh");
        bulb.SetActive(true);
        bulb.transform.position = companion.transform.position;
        bulb.GetComponent <Animator>().Play("Idea");
        yield return(new WaitForSeconds(1));

        bulb.SetActive(false);

        speachBubble.Say("In solchen Momenten\nverlässt sich der\nDetektiv", Bubbles.Normal, target: companion);
        speachBubble.Say("immer auf seinen\nsiebten Sinn!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookSad");
        player.GetComponent <VoiceScript>().PlayQuestion();
        yield return(new WaitForSeconds(1));

        anim_comp.Play("lookHappy");
        speachBubble.Say("Laufe einfach\nüber das Feld\nund grabe dort", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookAnnoyed");
        speachBubble.Say("wo dein Detektiv-\nSinn am stärksten\nausschlägt", Bubbles.Normal, target: companion);
        speachBubble.Say("mache mit dem\nHandy eine Schaufel-\nbewegung, um die", Bubbles.Normal, target: companion);
        speachBubble.Say("Kartoffeln auszugraben", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.SetTrigger("startMove");
        anim_comp.SetBool("moving", false);

        StartCoroutine(RunPotatoGame());
        yield break;
    }
Ejemplo n.º 5
0
    protected override IEnumerator PlaySequence()
    {
        yield return(new WaitForSeconds(2.4f));//warte, bis die Blende vollständig da ist

        StartCoroutine(Setup());
        Animator   anim        = GetComponent <Animator>();
        GameObject farmer      = transform.parent.GetChild(1).gameObject;
        Animator   anim_farmer = farmer.transform.GetChild(0).GetComponent <Animator>();

        player.transform.position      = new Vector3(222, -2);
        companion.transform.position   = new Vector3(218, -2);
        companion.transform.localScale = Vector3.one;
        player.transform.localScale    = companion.transform.localScale;

        cScript.transform.position = new Vector3(player.transform.position.x, player.transform.position.y, -10);
        StartCoroutine(cScript.SetRotation());
        Camera.main.orthographicSize = 8;

        manager.PlayNormal();
        menu.DoTransition(1, -1, true);//nutze vorherige transition
        yield return(new WaitForSeconds(1.4f));

        //Komme an:
        anim_player.SetBool("moving", true);
        anim_comp.SetBool("moving", true);
        anim_player.SetTrigger("startMove");
        anim_comp.SetTrigger("startMove");
        Vector3 stepPos = Vector3.right * 10 * Time.fixedDeltaTime / 2;

        for (float count = 0; count < 2; count += Time.fixedDeltaTime)
        {
            companion.transform.position += stepPos;
            player.transform.position    += stepPos;
            yield return(new WaitForFixedUpdate());
        }
        anim_player.SetBool("moving", false);
        anim_comp.SetBool("moving", false);


        speachBubble.Say("Da sind wir wieder.", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookFocused");
        speachBubble.Say("Die Kartoffeln\nwaren gut versteckt", Bubbles.Normal, target: companion);
        speachBubble.Say("Aber irgendwann\nbringen wir immer  alles\nans Licht!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //wirf den Korb voller Kartoffeln auf den Boden:
        anim_comp.Play("Squeesh");
        GameObject basket = anim_comp.transform.GetChild(0).GetChild(0).GetChild(2).gameObject;

        basket.transform.parent   = null;
        basket.transform.rotation = Quaternion.Euler(0, 0, 90);
        Vector3 startPos = basket.transform.position;

        for (float count = 0; count < 1; count += Time.fixedDeltaTime)
        {
            basket.transform.position = startPos + new Vector3(-3 * count, flightPath.Evaluate(count) * 3);
            yield return(new WaitForFixedUpdate());
        }

        anim.SetTrigger("next");//shock
        yield return(new WaitForSeconds(1f));

        anim_player.Play("Squeesh");
        yield return(new WaitForSeconds(.3f));

        anim_farmer.Play("JumpScare");
        speachBubble.Say("Oh nein!\nIhr habt sie\nwieder ausgegraben!", Bubbles.Shouting, fontSize: 30);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookSad");
        yield return(new WaitForSeconds(.1f));

        anim_comp.Play("lookPuzzled");
        speachBubble.Say("Wie wir besprochen\nhaben", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("smallJump");
        yield return(new WaitForSeconds(.5f));

        anim_farmer.Play("smallJump1");
        yield return(new WaitForSeconds(.5f));

        anim_farmer.Play("smallJump");
        yield return(new WaitForSeconds(.5f));

        speachBubble.Say("Warum, denkt ihr wohl,\nwurden die Kartoffeln\neingegraben?", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        anim_comp.Play("smallJump");

        speachBubble.Say("Unsere Theorie ist,\ndass Piraten...", Bubbles.Normal, target: companion, autoPlay: true);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookAngry");
        speachBubble.Say("Die Wühlmäuse\nhaben sie verbuddelt\ndamit noch mehr\nKartoffeln wachsen", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim.SetTrigger("next");//resume explanation
        anim_farmer.Play("lookPuzzled");
        anim_player.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_comp.Play("JumpScare");
        speachBubble.Say("Anscheinend kennen\nsie sich unglaublich\ngut mit Land-\nwirtschaft aus!", Bubbles.Normal, target: farmer);
        speachBubble.Say("Sogar noch besser als ich!", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookAnnoyed");
        speachBubble.Say("Sie versuchen mir\ngerade beizubringen\nwie man richtig Kartoffeln\nanbaut", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookSad");
        yield return(new WaitForSeconds(.1f));

        anim_player.Play("lookSad");
        speachBubble.Say("Heißt das,\nunsere Arbeit war\nfür umsonst?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("Squeesh");
        speachBubble.Say("...wie?\nNun...\n...naja...", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        //Idee:
        anim_farmer.Play("Squeesh");
        GameObject bulb = farmer.transform.parent.GetChild(2).gameObject;

        bulb.SetActive(true);
        bulb.transform.position = farmer.transform.position + Vector3.up;
        bulb.GetComponent <Animator>().Play("Idea");
        yield return(new WaitForSeconds(1));

        bulb.SetActive(false);

        speachBubble.Say("Umsonst war\ndas nicht!", Bubbles.Normal, target: farmer);
        speachBubble.Say("Schließlich habt\nihr gut mein \nFeld umgegraben", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("smallJump");
        speachBubble.Say("Heißt das,\nwir dürfen ein paar\nKartoffeln behalten?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookHappy");
        speachBubble.Say("Aber natürlich!\nVersprochen ist\nVersprochen!", Bubbles.Normal, target: farmer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_farmer.Play("lookNormal");

        anim_player.Play("lookHappy");
        yield return(new WaitForSeconds(.1f));

        anim_comp.Play("lookHappy");

        speachBubble.Say("Hurra", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        manager.ChangeClothes();
        StartCoroutine(TasklistScript.SetTaskList(true));
        yield return(new WaitForSeconds(1));

        runGame   = false;
        staticCam = false;
        pauseMove = false;
        companion.GetComponent <FollowScript>().enabled = true;
        player.GetComponent <PlayerScript>().enabled    = true;
        player.GetComponent <Collider2D>().enabled      = true;
        player.GetComponent <Rigidbody2D>().simulated   = true;
        anim_player.SetTrigger("startMove");
        anim_comp.SetTrigger("startMove");
        cScript.target = player;
        cScript.offset = Vector2.up * 2;
        //EndSequence();
        yield break;
    }
Ejemplo n.º 6
0
    IEnumerator RunSequence()
    {
        StartCoroutine(TasklistScript.SetTaskList(false));
        cScript.aSrc.Stop();
        yield return(new WaitForEndOfFrame());

        cScript.aSrc.clip = Seq_clip;
        cScript.aSrc.Play();

        StartCoroutine(cScript.SetRotation());
        StartCoroutine(cScript.SetZoom(10));
        cScript.strength = .02f;
        cScript.offset   = Vector2.zero;
        camFocus.transform.localPosition = new Vector3(0, 1);
        yield return(new WaitForSeconds(1));

        companion.GetComponent <FollowScript>().enabled = false;
        player.GetComponent <Rigidbody2D>().bodyType    = RigidbodyType2D.Static;
        yield return(new WaitForSeconds(.1f));

        player.transform.GetChild(0).GetComponent <Animator>().SetBool("inAir", false);
        yield return(new WaitForSeconds(.25f));


        //Nach den Hühnern schauen:
        camFocus.transform.localPosition = new Vector3(11, 1);
        companion.transform.parent       = transform;
        player.transform.parent          = transform;
        Animator anim        = GetComponent <Animator>();
        Animator anim_comp   = companion.transform.GetChild(0).GetComponent <Animator>();
        Animator anim_player = player.transform.GetChild(0).GetComponent <Animator>();


        anim_comp.SetBool("moving", true);
        anim_comp.SetTrigger("startMove");
        Vector3 step = Vector3.right * .1f;

        while (companion.transform.localPosition.x < 3)
        {
            companion.transform.position += step;
            yield return(new WaitForFixedUpdate());
        }
        anim_comp.SetBool("moving", false);
        anim.Rebind();

        anim_comp.Play("lookPuzzled");
        yield return(new WaitForSeconds(2));

        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        camFocus.transform.localPosition = new Vector3(-3, 1);
        anim.Play("moveLeft");
        anim_comp.SetTrigger("startMove");
        anim_comp.SetBool("moving", true);
        yield return(new WaitForSeconds(3));

        anim_comp.SetBool("moving", false);
        anim_comp.Play("lookFocused");
        yield return(new WaitForSeconds(2));

        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        anim_comp.Play("lookAnnoyed");

        speachBubble.Say("Die Hühner sind alle weg\nKeine einzige Feder ist hier.", Bubbles.Normal, target: companion);
        speachBubble.Say("Ob das das Werk\neines Fuchs ist?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("Squeesh");
        player.GetComponent <VoiceScript>().PlayQuestion();
        yield return(new WaitForSeconds(.5f));

        anim_player.Play("lookSad");
        yield return(new WaitForSeconds(.5f));

        speachBubble.Say("Stimmt!\nHätte der Fuchs sie alle\ngefressen,", Bubbles.Normal, target: companion);
        speachBubble.Say("dann hätte er sie\nvorher rupfen und\nbraten müssen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookPuzzled");
        cScript.strength = 0.1f;
        cScript.offset   = Vector3.up * 2;
        StartCoroutine(cScript.SetRotation(20, 0.5f));
        StartCoroutine(cScript.SetZoom(5, .5f));
        cScript.target = companion;
        yield return(new WaitForSeconds(.5f));

        speachBubble.Say("Aber hier ist\nnirgendswo\nein OFEN!!!", Bubbles.Normal, target: companion, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        cScript.target   = camFocus;
        cScript.strength = 0.03f;
        cScript.offset   = Vector3.zero;
        StartCoroutine(cScript.SetRotation());
        StartCoroutine(cScript.SetZoom(10, 2));
        camFocus.transform.localPosition = Vector3.up * 1;

        anim_comp.Play("lookNormal");
        anim_player.Play("lookAnnoyed");
        yield return(new WaitForSeconds(1));

        player.GetComponent <VoiceScript>().PlayMumble();
        yield return(new WaitForSeconds(1));

        anim_player.Play("lookNormal");


        anim_comp.SetBool("moving", true);
        anim_comp.SetTrigger("startMove");
        anim.Play("moveRight");
        yield return(new WaitForSeconds(3.5f));

        anim_comp.SetBool("moving", false);
        yield return(new WaitForSeconds(.5f));

        anim_comp.SetBool("moving", true);
        anim.Play("moveLeftAgain");
        yield return(new WaitForSeconds(2.5f));

        anim_comp.SetBool("moving", false);
        anim_comp.Play("lookFocused");

        speachBubble.Say("Hhhhmmm......\nWas ist mit den\nHühnern passiert?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(2));

        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        anim_comp.Play("Squeesh");
        anim.Play("getIdea");
        yield return(new WaitForSeconds(2));

        anim_comp.Play("lookScared");
        cScript.strength = 0.1f;
        cScript.offset   = Vector3.up * 2;
        StartCoroutine(cScript.SetRotation(-20, 0.5f));
        StartCoroutine(cScript.SetZoom(5, .5f));
        cScript.target = companion;
        yield return(new WaitForSeconds(.5f));

        speachBubble.Say("Sie müssen alle\nvon ALIENS entführt\nworden sein!", Bubbles.Shouting, target: companion, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        cScript.strength = .05f;
        StartCoroutine(cScript.SetRotation());
        StartCoroutine(cScript.SetZoom(8));
        cScript.target = player;

        anim_player.Play("lookAngry");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(1));

        anim_player.Play("lookNormal");

        StartCoroutine(cScript.SetZoom(10));

        speachBubble.Say("Sicher, dass es keine\nAuserirdischen waren?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookSad");
        yield return(new WaitForSeconds(1));

        anim_player.Play("lookAnnoyed");
        yield return(new WaitForSeconds(.1f));

        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(3));

        anim_comp.Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        anim_comp.Play("Squeesh");
        yield return(new WaitForSeconds(2));

        anim_player.Play("lookNormal");

        speachBubble.Say("Wahrscheinlich\nhast du recht...", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookAngry");
        anim.Play("UfoFlyBy");

        speachBubble.Say("So eine Hühnerkacke!\nWie sollen wir jetzt an\ndie Eier und die\nBrühe kommen?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));


        player.GetComponent <VoiceScript>().PlayQuestion();
        anim_player.Play("lookSad");
        yield return(new WaitForSeconds(.1f));

        anim_player.Play("Squeesh");
        yield return(new WaitForSeconds(1));

        anim_comp.Play("lookSad");

        StartCoroutine(cScript.SetZoom(8));

        speachBubble.Say("Sieht so aus, als ob\nwir doch nicht zu unserem\nKartoffelkuchen kommen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookNormal");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(.2f));

        anim_player.Play("JumpScare");
        yield return(new WaitForSeconds(1f));

        SceneManager.LoadScene("ChickenHunt");
        yield break;
    }
    IEnumerator StartSequence()
    {
        Animator    anim        = GetComponent <Animator>();
        AudioSource aSrc_player = player.GetComponent <AudioSource>();

        cScript.aSrc.Stop();

        runGame                          = true;
        pauseMove                        = true;
        staticCam                        = true;
        camFocus                         = transform.GetChild(0).gameObject;
        cScript.target                   = MillScript.millSeq_Object;
        cScript.offset                   = Vector3.up * 5;
        cScript.transform.position       = cScript.target.transform.position + Vector3.back * 10;
        camFocus.transform.localPosition = Vector3.zero;

        MillScript.millSeq_Object.transform.GetChild(1).gameObject.SetActive(true);

        //blende:
        GameObject transition = canvas.transform.GetChild(canvas.transform.childCount - 1).gameObject;

        transition.SetActive(true);
        mat_busTrans = transition.GetComponent <Image>().material;
        transition.GetComponent <Image>().material = mat_explsn;
        transition.GetComponent <Image>().color    = Color.white;
        Material mat_trans = transition.GetComponent <Image>().material;

        mat_trans.SetFloat("_start", 1);
        mat_trans.SetFloat("_end", 0.95f);
        yield return(new WaitForFixedUpdate());

        StartCoroutine(TasklistScript.SetTaskList(false));


        //Bereite Player und Companion für die Sequenz vor:
        player.GetComponent <Rigidbody2D>().bodyType    = RigidbodyType2D.Static;
        companion.GetComponent <FollowScript>().enabled = false;
        yield return(new WaitForSeconds(.1f));

        //Positioniere Companion und Spieler:
        player.transform.position       = new Vector3(51, -2);
        companion.transform.position    = new Vector3(63, 4.5f);
        companion.transform.eulerAngles = new Vector3(0, 0, 122);
        companion.transform.GetChild(0).GetComponent <Animator>().SetBool("inAir", false);
        player.transform.GetChild(0).GetComponent <Animator>().SetBool("inAir", false);
        player.transform.parent    = transform;
        companion.transform.parent = transform;
        anim.Rebind();

        cScript.aSrc.clip = tumbleClip;
        cScript.aSrc.loop = false;
        cScript.aSrc.Play();

        //blende:
        mat_trans.SetFloat("_end", 1);
        for (float count = 0; count < 1; count += Time.fixedDeltaTime)
        {
            mat_trans.SetFloat("_start", count * 5 - 4);
            yield return(new WaitForFixedUpdate());
        }
        transition.SetActive(false);
        transition.GetComponent <Image>().color    = Color.black;
        transition.GetComponent <Image>().material = mat_busTrans;
        StartCoroutine(cScript.SetZoom(12, 2));

        yield return(new WaitForSeconds(3));

        manager.PlayNormal();

        cScript.strength = 0.2f;
        StartCoroutine(cScript.SetZoom(3, 0.5f));
        StartCoroutine(cScript.SetRotation(-30, .5f));
        cScript.target = MillScript.millSeq_Object.transform.GetChild(1).gameObject;
        cScript.offset = Vector2.up * 3;
        cScript.target.transform.GetChild(0).GetComponent <Animator>().Play("lookFurious");

        speachBubble.Say("MEINE MÜHLE!\nArrrrgh!!!", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        cScript.strength = 0.05f;
        StartCoroutine(cScript.SetZoom(8, 2));
        StartCoroutine(cScript.SetRotation(0, 2));
        yield return(new WaitForSeconds(1));

        camFocus.transform.localPosition = new Vector3(-13.5f, -8f);
        cScript.target = camFocus;

        yield return(new WaitForSeconds(2));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookInPain");

        speachBubble.Say("Aua!", Bubbles.Normal, fontSize: 20, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookNormal");
        anim.Play("StandUp");
        yield return(new WaitForSeconds(4.5f));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookSad");

        speachBubble.Say("Vielleicht sollten wir\nlieber verschwinden!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        player.transform.GetChild(0).GetComponent <Animator>().Play("lookAnnoyed");
        player.GetComponent <VoiceScript>().PlayMumble();
        yield return(new WaitForSeconds(1));

        StartCoroutine(TasklistScript.SetTaskList(true));
        yield return(new WaitForSeconds(.8f));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        player.transform.GetChild(0).GetComponent <Animator>().Play("lookNormal");


        yield return(new WaitForSeconds(.1f));

        player.transform.parent    = null;
        companion.transform.parent = null;
        SceneManager.MoveGameObjectToScene(player, SceneManager.GetActiveScene());//cuz I am stupid!
        SceneManager.MoveGameObjectToScene(companion, SceneManager.GetActiveScene());

        runGame   = false;
        staticCam = false;
        pauseMove = false;
        companion.GetComponent <FollowScript>().enabled = true;

        player.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
        player.transform.GetChild(0).GetComponent <Animator>().SetTrigger("startMove");
        companion.transform.GetChild(0).GetComponent <Animator>().SetTrigger("startMove");
        cScript.target        = player;
        progress.startSeqDone = true;
        LoadSave.SaveProgress();
        Destroy(gameObject);
        yield break;
    }
    /*
     * private void Start()
     * {
     *  runGame = true;
     *  pauseMove = true;
     *  staticCam = true;
     *  camFocus = transform.GetChild(0).gameObject;
     *  cScript.target = camFocus;
     *  StartCoroutine(RunSequence());
     * }
     * //*/
    IEnumerator RunSequence()
    {
        yield return(new WaitForFixedUpdate());

        StartCoroutine(TasklistScript.SetTaskList(false));
        GameObject guy         = transform.GetChild(1).gameObject;
        Animator   anim_player = player.transform.GetChild(0).GetComponent <Animator>();
        Animator   anim_comp   = companion.transform.GetChild(0).GetComponent <Animator>();

        StartCoroutine(cScript.SetRotation());
        StartCoroutine(cScript.SetZoom(5));
        StartCoroutine(cScript.SetBGM(music));
        cScript.offset = Vector2.zero;
        camFocus.transform.localPosition = new Vector3(7, 3);
        yield return(new WaitForSeconds(2));

        companion.GetComponent <FollowScript>().enabled = false;
        player.GetComponent <Rigidbody2D>().bodyType    = RigidbodyType2D.Static;
        yield return(new WaitForSeconds(.1f));

        player.transform.GetChild(0).GetComponent <Animator>().SetBool("inAir", false);

        anim_comp.SetBool("moving", true);
        anim_comp.SetTrigger("startMove");
        while (companion.transform.position.x - player.transform.position.x < 4)
        {
            companion.transform.position += Vector3.right * .1f;
            yield return(new WaitForFixedUpdate());
        }
        anim_comp.SetBool("moving", false);


        /* Guy redet:
         * Hey! Hey du da! Wie heißt du?
         *
         * Hey, ich mein dich! Wie heißt du?
         *
         * Sag schon, wie heißt du?
         */
        speachBubble.Say("Hey! Hey du da!\nWie heißt du?", Bubbles.Normal, target: guy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookScared");

        AudioSource aSrc_player = player.GetComponent <AudioSource>();

        menu.useLeftDecision = true;
        while (menu.useLeftDecision)
        {
            canvas.transform.GetChild(1).gameObject.SetActive(true);
            StartCoroutine(VoiceScript.GetSoundSample(triggerThresh: 1e-5f));
            yield return(new WaitUntil(() => VoiceScript.fetching));

            while (VoiceScript.fetching)
            {
                float waittime = Random.Range(10, 15);
                for (float count = 0; count < waittime && VoiceScript.fetching; count += Time.fixedDeltaTime)
                {
                    yield return(new WaitForFixedUpdate());
                }
                if (!VoiceScript.fetching)
                {
                    continue;
                }
                //VoiceScript.pauseFetching = true;
                //Guy fragt noch mal:
                switch (Random.Range(0, 3))
                {
                case 0: speachBubble.Say("Hey! Hey du da!\nWie heißt du?", Bubbles.Normal, target: guy, speed: .25f, autoPlay: true); break;

                case 1: speachBubble.Say("Hey, ich mein dich!\nWie heißt du?", Bubbles.Normal, target: guy, speed: .25f, autoPlay: true); break;

                case 2: speachBubble.Say("Sag schon,\nwie heißt du?", Bubbles.Normal, target: guy, speed: .25f, autoPlay: true); break;
                }
                //VoiceScript.pauseFetching = false;
            }
            canvas.transform.GetChild(1).gameObject.SetActive(false);
            speachBubble.Say("Wie war das?\nDu heißt <...> ?", Bubbles.Normal, target: guy);
            yield return(new WaitForSeconds(.3f));

            aSrc_player.Play();
            yield return(new WaitUntil(() => !speachBubble.finished));

            yield return(new WaitUntil(() => speachBubble.finished));

            yield return(new WaitWhile(() => aSrc_player.isPlaying));

            yield return(new WaitForSeconds(.5f));

            menu.SetDecisionActive(true);
            yield return(new WaitForSeconds(.1f));

            yield return(new WaitUntil(() => menu.decisionMade));

            yield return(new WaitForSeconds(1.5f));
        }
        playerCry.data = new float[VoiceScript.fetchedDataLength];
        aSrc_player.clip.GetData(playerCry.data, 0);
        LoadSave.SaveSound();


        speachBubble.Say("Ein sehr\nausgefallener Name.\n", Bubbles.Normal, target: guy);
        speachBubble.Say("Ich habe gehört\ndu hast heute\nGeburtstag", Bubbles.Normal, target: guy);
        speachBubble.Say("Ich habe hier quasi\nein Geburtstags-\ngeschenk für dich", Bubbles.Normal, target: guy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookNormal");
        speachBubble.Say("Eine geheime Kiste mit\ngeheimen Sachen drinnen", Bubbles.Normal, target: guy);
        speachBubble.Say("Für nur 15 Schmankerl\ngehört sie dir", Bubbles.Normal, target: guy);
        speachBubble.Say("Na, was ist?\nSind wir im Geschäft?", Bubbles.Normal, target: guy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(1.5f));

        anim_comp.Play("lookPuzzled");
        speachBubble.Say("Ich frage mich,\nwas in der Box\ndrinnen ist", Bubbles.Normal, target: companion);
        speachBubble.Say("Vielleicht wird\nja aus dem Einkauf\ndoch noch ein\nAbenteuer draus", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(1));

        anim_comp.Play("Squeesh");
        speachBubble.Say("Lass uns die\nKiste kaufen", Bubbles.Normal, target: companion);
        speachBubble.Say("Schließlich hat\nMama uns erlaubt,\ndass wir uns etwas\neigenes holen dürfen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(1));

        aSrc_player.GetComponent <VoiceScript>().PlayShout();
        player.transform.GetChild(0).GetComponent <Animator>().Play("Squeesh");
        for (int i = 2; i < 5; i++)
        {
            StartCoroutine(GiveObject(transform.GetChild(i).gameObject, player, guy)); yield return(new WaitForSeconds(.5f));
        }

        speachBubble.Say("Verkauft!", Bubbles.Normal, target: guy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(1));

        StartCoroutine(cScript.SetZoom(8, 2));

        GameObject myBox = Instantiate(box, guy.transform.position + Vector3.up * 5, Quaternion.identity);

        myBox.GetComponent <Rigidbody2D>().velocity = new Vector2(-3, 10);

        SpriteRenderer sprite_myBox = myBox.transform.GetChild(0).GetChild(0).GetComponent <SpriteRenderer>();

        sprite_myBox.color = new Color(1, 1, 1, 0);
        for (float count = 0; count < 1; count += Time.fixedDeltaTime)
        {
            sprite_myBox.color = new Color(1, 1, 1, count); yield return(new WaitForFixedUpdate());
        }

        yield return(new WaitForSeconds(1));

        runGame   = false;
        staticCam = false;
        pauseMove = false;
        player.GetComponent <Rigidbody2D>().bodyType = RigidbodyType2D.Dynamic;
        anim_player.SetTrigger("startMove");
        anim_comp.SetTrigger("startMove");
        companion.GetComponent <FollowScript>().enabled = true;
        cScript.target = player;
        Destroy(this);
        yield break;
    }
    IEnumerator Talk()
    {
        TasklistScript.SetTaskList(false);

        yield return(new WaitForSeconds(1));

        StartCoroutine(cScript.SetRotation());
        cScript.offset = Vector2.up * 2;
        cScript.target = transform.GetChild(1).gameObject;
        player.transform.GetChild(0).GetComponent <Animator>().Play("Squeesh");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(2));

        player.transform.GetChild(0).GetComponent <Animator>().Play("Idle");

        Animator anim = GetComponent <Animator>();

        anim.SetBool("right", player.transform.position.x > transform.GetChild(1).position.x);
        anim.SetTrigger("stopBuild");
        transform.GetChild(0).GetComponent <Collider2D>().enabled = false;

        steam.enabled = false;
        GameObject hammer   = transform.GetChild(1).GetChild(0).gameObject;
        Animator   anim_ham = transform.GetChild(1).GetChild(0).GetComponent <Animator>();

        anim_ham.Play("Squeesh");
        yield return(new WaitForSeconds(1));

        speachBubble.Say("Oh, Hallo!\nDas Haus ist leider\nnoch nicht fertig.", Bubbles.Normal, target: hammer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookHappy");
        speachBubble.Say("Falls ihr auch ein Haus\ngebaut haben wollt, dann\nbesucht doch die geheime\nGilde der Handwerker!", Bubbles.Normal, target: hammer);
        speachBubble.Say("Ihr findet sie direkt\nam anderen Ende\nder Stadt.", Bubbles.Normal, target: hammer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookFocused");
        speachBubble.Say("Aber sagt das keinem weiter.\nSie ist schließlich geheim!", Bubbles.Normal, target: hammer);
        speachBubble.Say("Niemand, der das\nKlopfpasswort nicht kennt,\nkommt da rein.", Bubbles.Normal, target: hammer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookHappy");
        speachBubble.Say("So, jetzt muss ich aber\nweiterarbeiten. Ein Haus\nbaut sich ja nicht\nvon allein!!", Bubbles.Normal, target: hammer);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_ham.Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        transform.GetChild(0).GetComponent <Collider2D>().enabled = true;
        anim.Play("BuildHouse");
        steam.enabled = true;

        cScript.target = companion;
        yield return(new WaitForSeconds(1.5f));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookFocused");

        speachBubble.Say("Hhhhhmmmmm...", Bubbles.Normal, target: companion);
        speachBubble.Say("Das Hämmern hört sich\nirgendwie schon fast wie\nein Klopfzeichen an... ", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        player.transform.GetChild(0).GetComponent <Animator>().Play("lookHappy");
        player.GetComponent <VoiceScript>().PlayShout();
        yield return(new WaitForSeconds(2));

        player.transform.GetChild(0).GetComponent <Animator>().Play("lookNormal");
        yield return(new WaitForSeconds(.1f));

        companion.transform.GetChild(0).GetComponent <Animator>().Play("lookNormal");
        yield return(new WaitForSeconds(.3f));

        talking        = false;
        pauseMove      = false;
        runGame        = false;
        staticCam      = false;
        cScript.target = player;
        companion.transform.GetChild(0).GetComponent <Animator>().SetTrigger("startMove");
        player.transform.GetChild(0).GetComponent <Animator>().SetTrigger("startMove");
        TasklistScript.SetTaskList(true);
        yield break;
    }
Ejemplo n.º 10
0
    protected override IEnumerator PlaySequence()
    {
        runGame = true;
        StartCoroutine(Setup());

        //Setze Camera:
        cScript.target               = player;
        cScript.offset               = Vector2.up * 2;
        cScript.transform.position   = new Vector3(player.transform.position.x, player.transform.position.y, -10);
        Camera.main.orthographicSize = 6;

        yield return(new WaitForSeconds(2));

        anim_comp.Play("lookAngry");
        speachBubble.Say("Wie soll Einkaufen\ndenn ein Abenteuer\nsein?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookPuzzled");
        speachBubble.Say("Die sind doch bloß\nzu faul selbst\neinkaufen zu gehen!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("smallJump");
        speachBubble.Say("Und dann noch diese\nEinkaufsliste!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //Zeige Liste:
        StartCoroutine(TasklistScript.SetTaskList(true));
        GameObject shopList = transform.GetChild(0).gameObject;

        shopList.SetActive(true);
        SpriteRenderer sprite = shopList.GetComponent <SpriteRenderer>();

        sprite.color = new Color(1, 1, 1, 0);
        Color stepColor = Color.black * Time.fixedDeltaTime;

        for (float count = 0; count < 1; count += Time.fixedDeltaTime)
        {
            sprite.color += stepColor;
            yield return(new WaitForFixedUpdate());
        }

        speachBubble.Say("Alles bis auf\ndie letzte Sache\nist klar", Bubbles.Normal, target: companion);
        anim_player.Play("lookSad");
        speachBubble.Say("Aber...", Bubbles.Normal, target: companion, speed: .1f);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookAngry");
        speachBubble.Say("Der ganze\nandere Kram!?", Bubbles.Shouting, fontSize: 35);
        speachBubble.Say("Was soll\ndas heißen?", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //Lasse Liste verschwinden:
        StartCoroutine(TasklistScript.SetTaskList(false));
        for (float count = 0; count < 1; count += Time.fixedDeltaTime)
        {
            sprite.color -= stepColor;
            yield return(new WaitForFixedUpdate());
        }
        Destroy(shopList);

        anim_player.Play("lookNormal");
        anim_comp.Play("lookFocused");
        speachBubble.Say("Wenigstens dürfen\nwir uns eine\nSüßware kaufen...", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookNormal");
        speachBubble.Say("Ok, lass uns\nzum Supermarkt\ngehen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(4));

        anim_comp.Play("lookPuzzled");
        speachBubble.Say("Ähm, hallo?\n hast du das gehen\nverlernt,\noder was?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(1));

        anim_player.Play("lookSad");
        StartCoroutine(cScript.SetRotation(-10, .5f));
        StartCoroutine(cScript.SetZoom(2, .5f));
        yield return(new WaitForSeconds(1));

        StartCoroutine(cScript.SetRotation(rotTime: .5f));
        StartCoroutine(cScript.SetZoom(6, .5f));
        yield return(new WaitForSeconds(1));

        anim_comp.Play("JumpScare");
        speachBubble.Say("Moment,\nWie bitte\n???", Bubbles.Shouting, fontSize: 35);
        speachBubble.Say("Du hast\ndas gehen\nverlernt?", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookAngry");
        speachBubble.Say("Na toll!\nUnd wie kommen\nwir jetzt bitte zum\nSupermarkt?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        speachBubble.Say("Lies mich", Bubbles.Normal);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_player.Play("JumpScare");

        speachBubble.Say("Hast du auch\ndie Stimme gehört?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_player.Play("lookNormal");
        anim_comp.Play("lookScared");
        speachBubble.Say("...Ist...\n...ist...das...\n...ein Geist?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        GameObject schildy     = transform.GetChild(0).gameObject;
        Animator   anim_schild = schildy.transform.GetChild(0).GetComponent <Animator>();
        SignScript signScript  = schildy.transform.GetChild(0).GetChild(0).GetComponent <SignScript>();

        signScript.enabled = false;
        anim_schild.Play("Squeesh");
        yield return(new WaitForSeconds(.75f));

        anim_schild.transform.GetChild(0).GetChild(0).gameObject.SetActive(true);
        anim_schild.Play("lookNormal");
        yield return(new WaitForSeconds(.5f));

        speachBubble.Say("Ich bin es bloß:\nSchildie", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("JumpScare");
        yield return(new WaitForSeconds(.1f));

        anim_player.Play("JumpScare");

        speachBubble.Say("AAAHHHHH!!!", Bubbles.Shouting, fontSize: 35);
        speachBubble.Say("Ein\nMonster!", Bubbles.Shouting, fontSize: 35);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookScared");
        yield return(new WaitForSeconds(.1f));

        anim_schild.Play("lookSad");
        speachBubble.Say("Das ist aber nicht\nsehr nett!", Bubbles.Normal, target: schildy);
        speachBubble.Say("Dabei wollte ich\neuch sogar helfen", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_schild.Play("Squeesh");
        speachBubble.Say("Wenn ihr ein Schild\nseht, dann tippt es an\num es zu lesen", Bubbles.Normal, target: schildy);
        speachBubble.Say("Es stehen mitunter\ninteressante Sachen\nauf uns Schildern", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("Squeesh");
        yield return(new WaitForSeconds(.75f));

        anim_comp.Play("lookPuzzled");

        speachBubble.Say("Aber stimmen\nauch die Dinge\ndie auf den Schildern\nstehen?", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_schild.Play("lookAngry");
        speachBubble.Say("Absolut!\nBei der Ehre aller\nSchilder", Bubbles.Normal, target: schildy);
        speachBubble.Say("garantiere ich\neuch, dass alles\nauf den Schildern\nwahr ist", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_schild.Play("smallJump");
        speachBubble.Say("Nur zu:\nProbiert es\nbei mir aus!", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        //Warte darauf, dass Schildy angtippt wird und zeige dann die Nachricht:
        touched = false;
        yield return(new WaitUntil(() => touched));

        GameObject sign = canvas.transform.GetChild(canvas.transform.childCount - 2).GetChild(0).gameObject;

        sign.transform.GetChild(0).GetChild(1).GetComponent <Text>().text = signScript.text_1;
        sign.transform.GetChild(0).GetChild(0).gameObject.SetActive(false);
        Canvas.ForceUpdateCanvases();

        sign.SetActive(true);
        Animator anim_sign = sign.GetComponent <Animator>();

        anim_sign.Play("ZoomIn");
        yield return(new WaitForSeconds(.5f));

        yield return(new WaitUntil(() => Input.touchCount == 0));

        yield return(new WaitUntil(() => Input.touchCount != 0));

        yield return(new WaitUntil(() => Input.touchCount == 0));

        anim_sign.Play("ZoomOut");
        yield return(new WaitForSeconds(.5f));

        sign.SetActive(false);


        anim_comp.Play("lookNormal");
        speachBubble.Say("Es scheint,\nals hättest du\nnicht gelogen", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_comp.Play("lookSad");
        speachBubble.Say("Tut mir leid,\ndass ich dir nicht\ngeglaubt habe!", Bubbles.Normal, target: companion);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_schild.Play("lookHappy");
        speachBubble.Say("Ich kann nicht lügen!\nEs steht mir halt\nimmer ins Gesicht\ngeschrieben", Bubbles.Normal, target: schildy);
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        anim_schild.Play("lookNormal");


        anim_comp.Play("smallJump");
        yield return(new WaitForSeconds(.6f));

        anim_comp.Play("smallJump1");
        yield return(new WaitForSeconds(.6f));

        anim_comp.Play("smallJump");
        yield return(new WaitForSeconds(.6f));

        speachBubble.Say("Ok, jetzt aber\nauf zum\nSupermarkt", Bubbles.Normal, target: companion);
        StartCoroutine(TasklistScript.SetTaskList(true));
        yield return(new WaitUntil(() => !speachBubble.finished));

        yield return(new WaitUntil(() => speachBubble.finished));

        yield return(new WaitForSeconds(.5f));

        signScript.enabled       = true;
        schildy.transform.parent = null;
        EndSequence();
        yield break;
    }