Пример #1
0
    // Update is called once per frame
    void Update()
    {
        // Items Dialog
        if (teddy.getColliderStateEnter() == true)
        {
            tState = true;
        }
        if (tState && Input.GetKeyDown(KeyCode.F))
        {
            dialogManager.setDialog("teddy.txt");
        }
        if (teddy.getColliderStateExit() == true)
        {
            tState = false;
        }

        if (wife.getColliderStateEnter() == true)
        {
            wState = true;
        }
        //Debug.Log ("This is wState: " + wState);
        if (wState && Input.GetKeyDown(KeyCode.F))
        {
            dialogManager.setDialog("wife.txt");
            //Debug.Log ("DialogManager finish");
        }
        if (wife.getColliderStateExit() == true)
        {
            wState = false;
        }

        if (basketball.getColliderStateEnter() == true)
        {
            bState = true;
        }
        if (bState && Input.GetKeyDown(KeyCode.F))
        {
            dialogManager.setDialog("basketball.txt");
        }
        if (basketball.getColliderStateExit() == true)
        {
            bState = false;
        }

        if (armchair.getColliderStateEnter() == true)
        {
            aState = true;
        }
        if (aState && Input.GetKeyDown(KeyCode.F))
        {
            dialogManager.setDialog("armchair.txt");
        }
        if (armchair.getColliderStateExit() == true)
        {
            aState = false;
        }

        if (isActive)
        {
            dialogManager.setRoom("room_A");
            player.setRoom("room_A");


            switch (eventCounter)
            {
            case 0:

                player.freeze();
                dialogManager.setDialog("thebeginning.txt");
                eventCounter++;
                break;

            case 1:
                if (dialogManager.getDialogOutput() == "falling")
                {
                    playerCamera.enabled = false;
                    if (victimCamera != null)
                    {
                        victimCamera.enabled = true;
                    }
                    float tempLocX  = victim.transform.position.x;
                    float tempLocY  = victim.transform.position.y;
                    float tempSizeX = victim.transform.localScale.x;
                    float tempSizeY = victim.transform.localScale.y;

                    fallingState = true;

                    if (fallingState)
                    {
                        if (victim.transform.position.y > -10.8f)
                        {
                            speed    += 9.82f * Time.deltaTime;
                            tempLocY  = victim.transform.position.y - 0.1f * Time.deltaTime * speed;
                            tempSizeX = victim.transform.localScale.x - 0.2f * Time.deltaTime;
                            tempSizeY = victim.transform.localScale.y - 0.24f * Time.deltaTime;
                        }

                        victim.transform.position   = new Vector3(tempLocX, tempLocY, 0f);
                        victim.transform.localScale = new Vector3(tempSizeX, tempSizeY, 1f);
                        if (victim.transform.position.y <= -10.8f)
                        {
                            victimSprite.enabled = false;
                        }
                    }
                }
                if (dialogManager.getDialogOutput() == "fallingEnd")
                {
                    if (victimCamera != null)
                    {
                        victimCamera.enabled = false;
                    }
                    playerCamera.enabled = true;
                    fallingState         = false;
                    Destroy(victim);
                }
                if (dialogManager.getDialogOutput() == "endingDialogue")
                {
                    audio.GetComponent <AudioSource> ().Play();
                    player.unfreeze();
                    roomSolved = true;
                    eventCounter++;
                }
                break;

            case 2:
                break;
            }

            if (roomSolved)
            {
                if (exitDoor.isLocked())
                {
                    File.Delete("dialog/room_A/ItemHolder.txt");

                    aDark          = GameObject.Find("anfangsraumD").GetComponent <SpriteRenderer>();
                    aDark.enabled  = true;
                    r1Dark         = GameObject.Find("raum1D").GetComponent <SpriteRenderer>();
                    r1Dark.enabled = false;
                    endAndProceed();
                }
            }
        }
    }
Пример #2
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            dialogManager.setRoom("room_2");
            player.setRoom("room_2");

            switch (eventCounter)
            {
            case 0:
                dialogManager.setDialog("conversationWithFire.txt");
                eventCounter++;
                break;

            case 1:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }

                break;


            case 2:
                Debug.Log("I'm here :>");

                /*dialogManager.setDialog ("areYouAngry.txt");
                 * if(dialogManager.getDialogOutput()=="selfIsCalm"){
                 *      eventCounter++;
                 *      player.unfreeze ();
                 * }*/
                eventCounter++;
                break;

            case 3:
                exitDoor.setIsLocked();
                roomSolved = true;
                eventCounter++;
                break;

            case 4:
                break;
            }



            if (roomSolved)
            {
                if (exitDoor.isLocked())
                {
                    //File.Delete("dialog/room_2/ItemHolder.txt");
                    r2Dark         = GameObject.Find("raum2D").GetComponent <SpriteRenderer>();
                    r2Dark.enabled = true;
                    r1Dark         = GameObject.Find("raum3D").GetComponent <SpriteRenderer>();
                    r1Dark.enabled = false;
                    endAndProceed();
                }
            }
        }
    }
Пример #3
0
    // Update is called once per frame
    void Update()
    {
        //Debug.Log ("THis is gameobject: " + NPC2.transform.name);
        //Debug.Log (dialogManager.getDialogOutput ());

        if (isActive)
        {
            dialogManager.setRoom("room_P");
            player.setRoom("room_P");

            switch (eventCounter)
            {
            case 0:
                //NPC2.SetActive (false);
                npc.moveTo(0f, -0.33f);
                eventCounter++;
                break;

            case 1:

                if (event1.getColliderStateEnter() == true)
                {
                    player.freeze();
                    dialogManager.setDialog("First_Meeting.txt");
                }

                if (dialogManager.getDialogOutput() == "npcmove")
                {
                    npc.moveRelative(0f, -3.5f);
                    eventCounter++;
                }


                break;


            case 2:
                dialogManager.setDialog("Next_Step.txt");
                if (dialogManager.isActive() == false)
                {
                    //Debug.Log ("IM HERE");
                    eventCounter++;
                }
                break;

            case 3:
                NPC2.enabled = true;
                dialogManager.setDialog("Final.txt");
                if (dialogManager.getDialogOutput() == "falling")
                {
                    aDark                = GameObject.Find("anfangsraumD").GetComponent <SpriteRenderer> ();
                    aDark.enabled        = false;
                    wasRead              = true;
                    playerCamera.enabled = false;
                    npcCamera.enabled    = true;
                    //falling (victim.transform.position.x,-10.5f);
                    float tempLocX  = npc_object.transform.position.x;
                    float tempLocY  = npc_object.transform.position.y;
                    float tempSizeX = npc_object.transform.localScale.x;
                    float tempSizeY = npc_object.transform.localScale.y;

                    fallingState = true;

                    if (fallingState)
                    {
                        if (npc_object.transform.position.y > -10.8f)
                        {
                            speed    += 9.82f * Time.deltaTime;
                            tempLocY  = npc_object.transform.position.y - 0.1f * Time.deltaTime * speed;
                            tempSizeX = npc_object.transform.localScale.x - 0.015f * Time.deltaTime;
                            tempSizeY = npc_object.transform.localScale.y - 0.015f * Time.deltaTime;
                        }


                        npc_object.transform.position   = new Vector3(tempLocX, tempLocY, 0f);
                        npc_object.transform.localScale = new Vector3(tempSizeX, tempSizeY, 1f);
                        if (npc_object.transform.position.y <= -10.8f)
                        {
                            npcSprite.enabled    = false;
                            npcAnimation.enabled = false;
                            eventCounter++;
                        }
                    }
                }


                break;

            case 4:
                float tempY = npcCamera.transform.position.y - Time.deltaTime;
                npcCamera.transform.position = new Vector3(npcCamera.transform.position.x, tempY, npcCamera.transform.position.z);
                if (tempY <= -12.5f)
                {
                    eventCounter++;
                }
                break;

            case 5:

                delay -= Time.deltaTime;
                if (delay <= 0)
                {
                    SceneManager.LoadScene("the_end");
                    roomSolved = true;
                }
                break;
            }



            if (roomSolved)
            {
                File.Delete("dialog/room_P/ItemHolder.txt");
                endAndProceed();
            }
        }
    }
Пример #4
0
    // Update is called once per frame
    void Update()
    {
        if (mudSwitch.isSwitchedOn())
        {
            mud.fill(); colliderE.enabled = false;
        }
        if (!mudSwitch.isSwitchedOn())
        {
            mud.drain(); colliderE.enabled = true;

            //audio.GetComponent<AudioSource> ().Stop ();
        }

        if (mud.isFilling())
        {
            player.setSpeed(drainedPlayerSpeed(player.getX(), player.getY(), defaultPlayerSpeed));

            audio.GetComponent <AudioSource> ().Play();
        }

        if (isActive)
        {
            dialogManager.setRoom("room_4");
            player.setRoom("room_4");

            switch (eventCounter)
            {
            case 0:


                if (mudSwitch.isSwitchedOn())
                {
                    eventCounter++;
                }


                break;

            case 1:

                exitDoor.setIsLocked();                 //exitDoor locked=false!! (unlock)
                roomSolved = true;
                eventCounter++;

                break;


            case 2:

                if (distanceToEscape > 10 && distanceToEscape < 15)
                {
                    dialogManager.setDialog("dialog1.txt");
                    eventCounter++;
                }
                break;

            case 3:
                if (distanceToEscape > 7 && distanceToEscape < 10)
                {
                    dialogManager.setDialog("dialog2.txt");
                    eventCounter++;
                }
                break;


            case 4:
                if (distanceToEscape > 5 && distanceToEscape < 7)
                {
                    dialogManager.setDialog("dialog3.txt");
                    eventCounter++;
                }
                break;

            case 5:
                if (distanceToEscape > 4 && distanceToEscape < 5)
                {
                    dialogManager.setDialog("dialog4.txt");
                    eventCounter++;
                }
                break;


            case 6:
                if (distanceToEscape > 3 && distanceToEscape < 4)
                {
                    dialogManager.setDialog("dialog5.txt");
                    eventCounter++;
                }
                break;

            case 7:

                break;
            }



            if (roomSolved)
            {
                if (exitDoor.isLocked())
                {
                    //GetComponent<AudioSource> ().enabled = false;
                    player.setSpeed(defaultPlayerSpeed);
                    File.Delete("dialog/room_4/ItemHolder.txt");
                    r4Dark         = GameObject.Find("raum4D").GetComponent <SpriteRenderer>();
                    r4Dark.enabled = true;
                    r5Dark         = GameObject.Find("raum5D").GetComponent <SpriteRenderer>();
                    r5Dark.enabled = false;
                    endAndProceed();
                }
            }
        }
    }
Пример #5
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            dialogManager.setRoom("room_5");
            player.setRoom("room_5");

            switch (eventCounter)
            {
            case 0:
                if (event1.getColliderStateEnter() == true)
                {
                    audio.GetComponent <AudioSource> ().Play();

                    player.freeze();
                    dialogManager.setDialog("beforeTheEnd.txt");
                }
                if (dialogManager.getDialogOutput() == "endingDialogue")
                {
                    player.unfreeze();
                    eventCounter++;
                }

                break;

            case 1:
                if (event2.getColliderStateEnter() == true)
                {
                    player.freeze();
                    dialogManager.setDialog("scaryScene.txt");
                }
                if (dialogManager.getDialogOutput() == "endingDialogue2")
                {
                    player.unfreeze();
                    eventCounter++;
                }

                break;


            case 2:
                eventCounter++;

                break;

            case 3:
                roomSolved = true;
                eventCounter++;
                break;

            case 4:
                break;
            }



            if (roomSolved)
            {
                if (exitDoor.checkDark())
                {
                    File.Delete("dialog/room_5/ItemHolder.txt");
                    endAndProceed();
                }
            }
        }
    }
Пример #6
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            dialogManager.setRoom("room_1");
            player.setRoom("room_1");


            switch (eventCounter)
            {
            case 0:
                //dialogManager.setDialog ("Lala lulu!");
                //player.freeze();

                dialogManager.setDialog("contrastEncounter.txt");
                eventCounter++;
                break;

            case 1:

                if (scaryPainting.interactionOccurred())
                {
                    dialogManager.setDialog("scaryPainting_firstLook.txt");
                    eventCounter++;
                }

                break;


            case 2:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("beautifulPainting_firstLook.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                    eventCounter++;
                }

                break;

            case 3:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }
                break;

            case 4:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("beautifulPainting_secondLook.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                    eventCounter++;
                }
                break;

            case 5:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }
                break;

            case 6:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("beautifulPainting_thirdLook.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                    eventCounter++;
                }
                break;


            case 7:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }
                break;


            case 8:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("beautifulPainting_fourthLook.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                    eventCounter++;
                }
                break;

            case 9:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }
                break;

            case 10:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("inDenial.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                    eventCounter++;
                }
                break;

            case 11:
                //Debug.Log ("Dialog still running: "+dialogManager.isActive());
                if (!dialogManager.isActive())
                {
                    eventCounter++;
                }
                break;

            case 12:
                if (beautifulPainting.interactionOccurred())
                {
                    //Debug.Log ("Dialog running: "+dialogManager.isActive());
                    dialogManager.setDialog("finalChoice.txt");
                    //Debug.Log ("...and running: "+dialogManager.isActive());
                }
                if (dialogManager.getDialogOutput() == "paintingBeingRipped")
                {
                    eventCounter++;
                }
                break;


            case 13:
                eventCounter++;
                break;

            case 14:
                //dialogManager.setDialog ("talkingToSomeone.txt");
                //if(!dialogManager.isActive()){eventCounter++;}
                eventCounter++;
                break;



            case 15:
                beautifulPainting.ripPainting();
                exitDoor.setIsLocked();                 //exitDoor locked=false!! (unlock)
                roomSolved = true;
                eventCounter++;

                break;
            }



            if (roomSolved)
            {
                if (exitDoor.isLocked())
                {
                    File.Delete("dialog/room_1/ItemHolder.txt");
                    r2Dark         = GameObject.Find("raum2D").GetComponent <SpriteRenderer>();
                    r2Dark.enabled = false;
                    r1Dark         = GameObject.Find("raum1D").GetComponent <SpriteRenderer>();
                    r1Dark.enabled = true;
                    endAndProceed();
                }
            }
        }
    }
Пример #7
0
    // Update is called once per frame
    void Update()
    {
        if (isActive)
        {
            dialogManager.setRoom("room_3");
            player.setRoom("room_3");

            switch (eventCounter)
            {
            case 0:
                if (event1.getColliderStateEnter())
                {
                    player.freeze();

                    if (player.getFirstItem() != null)
                    {
                        //Debug.Log ("FirstIsntHere");
                        dialogManager.setDialog("someitems.txt");
                        firstTime = false;
                    }
                    else if (firstTime)
                    {
                        dialogManager.setDialog("noitems.txt");
                    }
                    else
                    {
                        dialogManager.setDialog("lostitems.txt");
                        eventCounter++;
                    }
                }
                if (dialogManager.getDialogOutput() == "falling")
                {
                    collider.enabled = false;
                    if (timeCounter < 2f)
                    {
                        tempPlanken = planken.transform.position.y + Time.deltaTime * 2f;

                        planken.transform.position = new Vector3(planken.transform.position.x, tempPlanken, planken.transform.position.z);
                    }

                    if (timeCounter > .5f && (spieler.transform.position.y > 14))
                    {
                        tempPlanken = spieler.transform.position.y - Time.deltaTime * 1f;

                        spieler.transform.position = new Vector3(spieler.transform.position.x, tempPlanken, spieler.transform.position.z);

                        tempPlanken = spieler.transform.localScale.y - 0.05f * Time.deltaTime;

                        spieler.transform.localScale = new Vector3(tempPlanken, tempPlanken, 1f);
                    }

                    if (timeCounter > 1.5f && timeCounter < 3.5f)
                    {
                        tempPlanken = planken.transform.position.y - Time.deltaTime * 2f;

                        planken.transform.position = new Vector3(planken.transform.position.x, tempPlanken, planken.transform.position.z);
                    }
                    else if (timeCounter > 3.5f)
                    {
                        spieler.transform.localScale = new Vector3(0.025f, 0.025f, 1f);
                        timeCounter = 0f;
                        player.setSpeed(1f);
                        collider.enabled = true;
                        //player.unfreeze ();
                        dialogManager.setDialogOutputTo("");
                    }

                    timeCounter += Time.deltaTime;
                }
                if (dialogManager.getDialogOutput() == "delete")
                {
                    player.deleteIventory();
                }
                if (dialogManager.getDialogOutput() == "endDialog")
                {
                    //Debug.Log ("endDialog = true");
                    endDialog = true;
                }

                if (dialogManager.getDialogOutput() == "unfreeze")
                {
                    player.unfreeze();
                    dialogManager.setDialogOutputTo("");
                }
                if (dialogManager.isActive() == false && endDialog)
                {
                    eventCounter++;
                }



                break;

            case 1:
                player.unfreeze();
                eventCounter++;

                break;


            case 2:
                eventCounter++;

                break;

            case 3:

                exitDoor.setIsLocked();                 //exitDoor locked=false!! (unlock)
                roomSolved = true;
                eventCounter++;
                break;

            case 4:
                break;
            }



            if (roomSolved)
            {
                if (exitDoor.isLocked())
                {
                    File.Delete("dialog/room_3/ItemHolder.txt");
                    r4Dark         = GameObject.Find("raum4D").GetComponent <SpriteRenderer>();
                    r4Dark.enabled = false;
                    r3Dark         = GameObject.Find("raum3D").GetComponent <SpriteRenderer>();
                    r3Dark.enabled = true;
                    //audio.GetComponent<AudioSource> ().Stop ();
                    endAndProceed();
                }
            }
        }
    }