Exemplo n.º 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();
                }
            }
        }
    }
Exemplo n.º 2
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();
            }
        }
    }
Exemplo n.º 3
0
    //-------------- UPDATE ------------------

    void Update()
    {
        //---------- DEBUG NACHRICHTEN ---------------------------------------------------
//		Debug.Log("Speed: " + spieler.getSpeed());

        //---------- Variabeln, die jedes Update überprüft werden müssen -----------------
        playerPoint [0] = spieler.transform.position.x;
        playerPoint [1] = spieler.transform.position.y;
        parentName      = box.transform.parent.name;

        //---------- Hören die Collider ab -----------------------------------------------
        if (boxListener.getColliderStateEnter())
        {
            colliderActiv = true;
        }
        else if (boxListener.getColliderStateExit())
        {
            colliderActiv = false;

            //RESET
            switch (parentName)
            {
            case "R1_Treppe":
                break;

            case "AP_runterfallend":
                break;

            case "R3_untere_Treppe":
                break;

            case "R3_obere_Treppe":
                break;

            case "R4_Treppe":
                break;

            case "R5_Totenkopf_Gang":
                break;

            case "P_Totenkopf_Gang":
                break;

            case "P_Treppe":
                break;

            default:
                spieler.setSpeed(2f);
                realPlayer.transform.localScale = new Vector3(.05f, .05f, 1f);
                break;
            }
        }

        //---------- Distanz zum Collider im rechten Winkel -----------------------------
        distance = getDistance(playerPoint, colliderPointL, colliderPointR);

        switch (parentName)
        {
        //-------------------- A RUNTERFALLEND ------------------------------------------------
        case "AP_runterfallend":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    //spieler.setSpeed (2f - distance);
                    realPlayer.transform.localScale = new Vector3(.05f - 0.005f * distance, .05f - 0.005f * distance, 1f);
                }
            }
            break;

        //-------------------- R1 TREPPE ------------------------------------------------
        case "R1_Treppe":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(2f - (distance * 0.40f));
                    realPlayer.transform.localScale = new Vector3(.05f - 0.01f * distance, .05f - 0.01f * distance, 1f);
                }
            }
            break;

        //-------------------- R1R2 NORMALE GRÖßE ------------------------------------------
        case "R1R2_normale_Größe":
            break;

        //-------------------- R2 BRÜCKE ---------------------------------------------------
        case "R2_Brücke":

            if (colliderActiv == true)
            {
                if (distance > 0 && distance <= box.size.y / 2)
                {
                    //spielergröße bis zur mitte ansteigen lassen je nach abstand
                    spieler.setSpeed(1f + distance / 2);
                    realPlayer.transform.localScale = new Vector3(.05f + 0.01f * distance, .05f + 0.01f * distance, 1f);
                }
                else if (distance > 0)
                {
                    //differenz zur mitte (höchster punkt) lässt spieler bis zum verlassen der brücke wieder kleiner werden
                    tempDistance = (box.size.y / 2 - (distance - box.size.y / 2));
                    spieler.setSpeed(1f + tempDistance / 2);

                    realPlayer.transform.localScale = new Vector3(.05f + 0.01f * tempDistance, .05f + 0.01f * tempDistance, 1f);
                }
            }
            break;

        //-------------------- R3 UNTERE TREPPE -----------------------------------------------
        case "R3_untere_Treppe":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(1.67f - (distance * 0.20f));
                    realPlayer.transform.localScale = new Vector3(.04f - 0.0045f * distance, .04f - 0.0045f * distance, 1f);
                }
            }
            break;

        //-------------------- R3 OBERE TREPPE -----------------------------------------------
        case "R3_obere_Treppe":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(2f - (distance * 0.14f));
                    realPlayer.transform.localScale = new Vector3(.05f - 0.004251f * distance, .05f - 0.004251f * distance, 1f);
                }
            }
            break;

        //-------------------- R3 BRÜCKE -----------------------------------------------------
        case "R3_Brücke":

            if (colliderActiv == true)
            {
                if (distance > 0 && distance <= box.size.y / 2)
                {
                    //spielergröße bis zur mitte ansteigen lassen je nach abstand
                    spieler.setSpeed(1.5f + distance / 4);
                    realPlayer.transform.localScale = new Vector3(.05f + 0.0033f * distance, .05f + 0.0033f * distance, 1f);
                }
                else if (distance > 0)
                {
                    //differenz zur mitte (höchster punkt) lässt spieler bis zum verlassen der brücke wieder kleiner werden
                    tempDistance = (box.size.y / 2 - (distance - box.size.y / 2));
                    spieler.setSpeed(1.5f + tempDistance / 4);

                    realPlayer.transform.localScale = new Vector3(.05f + 0.0033f * tempDistance, .05f + 0.0033f * tempDistance, 1f);
                }
            }
            break;

        //-------------------- R4 TREPPE -----------------------------------------------------
        case "R4_Treppe":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(2f + (distance * 0.33f));
                    realPlayer.transform.localScale = new Vector3(.05f + 0.01f * distance, .05f + 0.01f * distance, 1f);
                }
            }
            break;

        //-------------------- R5 TOTENKOPF ---------------------------------------------------
        case "R5_Totenkopf_Gang":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(2f - distance * .33f);
                    realPlayer.transform.localScale = new Vector3(.05f - 0.00825f * distance, .05f - 0.00825f * distance, 1f);
                }
            }
            break;

        //-------------------- P TOTENKOPF ---------------------------------------------------
        case "P_Totenkopf_Gang":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(.8f + distance * .8975f);
                    realPlayer.transform.localScale = new Vector3(.02f + 0.02244f * distance, .02f + 0.02244f * distance, 1f);
                }
            }
            break;

        //-------------------- P TREPPE ------------------------------------------------------
        case "P_Treppe":
            if (colliderActiv == true)
            {
                if (distance > 0)
                {
                    spieler.setSpeed(3f - distance * .8857f);
                    realPlayer.transform.localScale = new Vector3(.075f - 0.02214f * distance, .075f - 0.02214f * distance, 1f);
                }
            }
            break;

        //-------------------- DEFAULT -------------------------------------------------------
        default: break;
        }
    }
Exemplo n.º 4
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();
                }
            }
        }
    }
Exemplo n.º 5
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();
                }
            }
        }
    }