Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        if ((interact.getPressed() || Input.GetKey("space")) && currentIntreactiveNPC)
        {
            if (currentIntreactiveNPC.talks)
            {
                currentIntreactiveNPC.Talk(npc, currentIntreactiveNPC);
            }
        }

        if (interact.getPressed() || Input.GetKey("space"))
        {
            if (currentGenericNpc)
            {
                if (currentGenericNpc.talks)
                {
                    currentGenericNpc.Talk();
                }
            }

            if (currentQuestNpc)
            {
                currentQuestNpc.Talk();
            }

            if (currentMerchant)
            {
                currentMerchant.Talk();
            }
        }
    }
Beispiel #2
0
    /// <summary>
    /// Turns Ozeros head around and moves her
    /// </summary>

    void Update()
    {
        if (!UpButton.getPressed() && !DownButton.getPressed() && !RightButton.getPressed() && !LeftButton.getPressed())
        {
            GetComponent <Rigidbody2D> ().velocity = new Vector2(0, 0);
        }
        if (UpButton.getPressed())
        {
            GetComponent <Rigidbody2D> ().velocity = new Vector2(0, -3);
            OzeroPaa.transform.eulerAngles         = new Vector3(0, 0, 0);
        }
        if (LeftButton.getPressed())
        {
            GetComponent <Rigidbody2D> ().velocity = new Vector2(3, 0);
            OzeroPaa.transform.eulerAngles         = new Vector3(0, 0, 90);
        }
        if (DownButton.getPressed())
        {
            GetComponent <Rigidbody2D> ().velocity = new Vector2(0, 3);
            OzeroPaa.transform.eulerAngles         = new Vector3(0, 0, 180);
        }
        if (RightButton.getPressed())
        {
            GetComponent <Rigidbody2D> ().velocity = new Vector2(-3, 0);
            OzeroPaa.transform.eulerAngles         = new Vector3(0, 0, -90);
        }
    }
    // Update is called once per frame: f means float point type
    void Update()
    {
        if (action.getPressed() && trigger.GettriggerCheck() && (overworld2))
        {
            Sprite house2 = Resources.Load("House2", typeof(Sprite)) as Sprite;
            Debug.Log(this.roomPicture);
            this.roomPicture.sprite        = house2;
            character.transform.position   = new Vector3(-8, -4, 0);
            character.transform.localScale = new Vector3(1.5f, 1.5f);
            trigger.transform.position     = new Vector3(5, 144, 0);
            trigger.transform.localScale   = new Vector3(3, 3);
        }
        else if (action.getPressed() && trigger.GettriggerCheck() && (pharmacyBool))
        {
            Sprite overworld = Resources.Load("Overworld", typeof(Sprite)) as Sprite;
            Debug.Log(this.roomPicture);
            this.roomPicture.sprite        = overworld;
            character.transform.position   = new Vector3(1.4f, -4, 0);
            character.transform.localScale = new Vector3(1.5f, 1.5f);
            trigger.transform.position     = new Vector3(8.2f, -4, 0);
            trigger.transform.localScale   = new Vector3(3, 3);
            overworld2 = true;
        }
        else if (action.getPressed() && trigger.GettriggerCheck() && (overworld1))
        {
            Sprite pharmacy = Resources.Load("Pharmacy", typeof(Sprite)) as Sprite;
            Debug.Log(this.roomPicture);
            this.roomPicture.sprite        = pharmacy;
            character.transform.position   = new Vector3(-7, -4, 0);
            character.transform.localScale = new Vector3(1.5f, 1.5f);
            trigger.transform.position     = new Vector3(-8, -4, 0);
            trigger.transform.localScale   = new Vector3(5, 5);
            pharmacyBool = true;
        }
        else if (action.getPressed() && trigger.GettriggerCheck())
        {
            Sprite overworld = Resources.Load("Overworld", typeof(Sprite)) as Sprite;
            Debug.Log(this.roomPicture);
            this.roomPicture.sprite         = overworld;
            overworldNpc.transform.position = new Vector3(-1, -4, 0);
            Destroy(bottle);
            Destroy(house1Npc);
            character.transform.position   = new Vector3(-4, -4, 0);
            character.transform.localScale = new Vector3(1.5f, 1.5f);
            trigger.transform.position     = new Vector3(1.4f, -4, 0);
            trigger.transform.localScale   = new Vector3(3, 3);
            overworld1 = true;
        }

        // Character moves left.
        if (left.getPressed())
        {
            character.transform.Translate(-0.1f, 0, 0);
        }
        // Character moves right.
        if (right.getPressed())
        {
            character.transform.Translate(0.1f, 0, 0);
        }
    }
Beispiel #4
0
 void Update()
 {
     if (startgame.getPressed())
     {
         SceneManager.LoadScene("main_scene");
     }
 }
Beispiel #5
0
 void Update()
 {
     if (back.getPressed())
     {
         SceneManager.LoadScene("main_menu");
     }
 }
Beispiel #6
0
 void Update()
 {
     if (endgame.getPressed())
     {
         DestroyObject(GameObject.Find("Music"));
         SceneManager.LoadScene("main_menu");
     }
 }
Beispiel #7
0
    void OnTriggerStay2D(Collider2D a)
    {
        Character character = a.gameObject.GetComponent <Character> ();

        character.addItem(gameObject.name);
        Debug.Log(a);
        if (action.getPressed() && gameObject.name == "House1NPC")
        {
            house1Npc = true;
        }
        if (gameObject.name == "OverworldNPC")
        {
            overworldNpc = true;
        }
    }
Beispiel #8
0
    // Update is called once per frame
    void Update()
    {
        moving = false;

        if (up.getPressed() || (Input.GetKey("w") && !moving))
        {
            playerRigidbody.AddForce(Vector2.up * speed);
            move     = new Vector2(0f, 1);
            lastMove = new Vector2(0f, 1);
            playerRigidbody.angularVelocity = 0;
            moving = true;
        }

        if (down.getPressed() || (Input.GetKey("s") && !moving))
        {
            playerRigidbody.AddForce(-Vector2.up * speed);
            move     = new Vector2(0f, -1);
            lastMove = new Vector2(0f, -1);
            playerRigidbody.angularVelocity = 0;
            moving = true;
        }

        if (left.getPressed() || (Input.GetKey("a") && !moving))
        {
            playerRigidbody.AddForce(-Vector2.right * speed);
            move     = new Vector2(-1, 0);
            lastMove = new Vector2(-1, 0);
            playerRigidbody.angularVelocity = 0;
            moving = true;
        }

        if (right.getPressed() || (Input.GetKey("d") && !moving))
        {
            playerRigidbody.AddForce(Vector2.right * speed);
            move     = new Vector2(1, 0);
            lastMove = new Vector2(1, 0);
            playerRigidbody.angularVelocity = 0;
            moving = true;
        }

        //Tells animator directions.
        anim.SetFloat("MoveX", move.x);
        anim.SetFloat("MoveY", move.y);
        anim.SetBool("Moving", moving);
        anim.SetFloat("LastMoveX", lastMove.x);
        anim.SetFloat("LastMoveY", lastMove.y);
    }
Beispiel #9
0
    void Update()
    {
        if (button.getPressed())
        {
            SceneManager.LoadScene("intro");
        }

        if (credits.getPressed())
        {
            SceneManager.LoadScene("Credits");
        }
        if (exit.getPressed())
        {
            //Debug.Log ("peliloppu");
            Application.Quit();
        }
    }
Beispiel #10
0
    /// <summary>
    /// Start this instance.
    /// </summary>
    void Start()
    {
        isActive = false;
        interact = GameObject.Find("Interact").GetComponent <PointerController> ();
        buy      = GameObject.Find("Buy1").GetComponent <PointerController> ();
        yes      = GameObject.Find("DialogueButtonYes").GetComponent <PointerController> ();
        no       = GameObject.Find("DialogueButtonNo").GetComponent <PointerController> ();
        ok       = GameObject.Find("DialogueOkButton").GetComponent <PointerController> ();

        gameController  = GameObject.Find("GameController").GetComponent <GameController> ();
        ObjectiveStatus = 0;
        gameController.ChangeObjective("Leave Hospital");
        yes.getPressed();
        dialogueButtons.SetActive(false);

        dialogueMap = new DialogueMap();
    }
Beispiel #11
0
    // Update is called once per frame
    void Update()
    {
        MoneyText.text       = "Money: " + player.wallet.GetSaldo() + "$";
        BulkText.text        = "Bulk: " + player.GetBulk() + " kcal";
        objectiveStatus.text = status;

        if (exitButton.getPressed())
        {
            SceneManager.LoadScene("main_menu");
            DestroyObject(GameObject.Find("Music"));
        }

        if (player.GetBulk() >= 15000)
        {
            SceneManager.LoadScene("end");
        }
    }
Beispiel #12
0
 // Update is called once per frame
 void Update()
 {
     if (up.getPressed())
     {
         ball.transform.Translate(0, 0.1f, 0);
         //Debug.Log ("YLÖS painettu");
     }
     if (down.getPressed())
     {
         ball.transform.Translate(0, -0.1f, 0);
         //Debug.Log ("ALAS painettu");
     }
     if (left.getPressed())
     {
         ball.transform.Translate(-0.1f, 0, 0);
         //Debug.Log ("LEFT painettu");
     }
     if (right.getPressed())
     {
         ball.transform.Translate(0.1f, 0, 0);
         //Debug.Log ("RIGHT painettu");
     }
 }
Beispiel #13
0
    /// <summary>
    /// Update this instance.
    /// </summary>
    void Update()
    {
        CheckPressed();
        dialogueBox.SetActive(isActive);

        if (StaticObjects.OBJECTIVE_VEGAN_BEATED && GameObject.Find("objectiveVegan") && !yes.getPressed())
        {
            dialogueBox.SetActive(false);
            DestroyObject(GameObject.Find("objectiveVegan"));
        }

        if (StaticObjects.QUEST_FAKEDOCTOR > 1 && GameObject.Find("FakeDoctorObjectiveNPC") && !yes.getPressed())
        {
            dialogueBox.SetActive(false);
            DestroyObject(GameObject.Find("FakeDoctorObjectiveNPC"));
        }

        if (isActive && interact.getPressed() && !locked)
        {
            isActive = false;
            locked   = true;
        }

        if (!isActive && !locked)
        {
            isLocked = false;
        }
        if (isActive && ok.getPressed() && !okPressed)
        {
            okPressed = true;
        }

        //BUY
        if (isActive && currentNpc.Equals(DialogueMap.BOB_BURGER) && StaticObjects.OBJECTIVE_VEGAN_BEATED && !StaticObjects.FREE_CHEESEBURGER_GAINED)
        {
            gameController.player.AddBulk(300);
            dialogueText.text = "Oh you got him to leave? Here is one cheeseburger as promised. \n\nWould you like to buy more?";
            StaticObjects.FREE_CHEESEBURGER_GAINED = true;
        }

        if (isActive && buy.getPressed() && !pressed)            //!!! DON'T CHANGE THIS
        {
            pressed = true;

            //NEW SYSTEM
            switch (currentNpc)
            {
            case DialogueMap.BRGCLUB:
                BuyProduct(DialogueMap.BRGCLUB);
                break;

            case DialogueMap.Le_AFFAME:
                BuyProduct(DialogueMap.Le_AFFAME);
                break;

            case DialogueMap.SHISH:
                BuyProduct(DialogueMap.SHISH);
                break;

            case DialogueMap.THE_BOGO:
                BuyProduct(DialogueMap.THE_BOGO);
                break;

            case DialogueMap.TOUGH:
                BuyProduct(DialogueMap.TOUGH);
                break;
            }


            //OLD SYSTEM
            if (currentNpc.Equals("Bob Burger"))
            {
                if (gameController.player.wallet.GetSaldo() >= 10)
                {
                    gameController.player.AddBulk(300);
                    gameController.player.wallet.UseMoney(10);
                    Debug.Log("Bought CheeseBurger!");
                    dialogueText.text = "There you go son, one CheeseBurger.";

                    if (!StaticObjects.OBJECTIVE_VEGAN_BEATED)
                    {
                        dialogueText.text += "\n\nIf you can drive off that annoying vegan outside, I'll give you a free burger.";
                        StaticObjects.FREE_CHEESEBURGER = true;
                    }
                }
                else
                {
                    dialogueText.text = "Son, you poor as f**k!";
                    if (!StaticObjects.OBJECTIVE_VEGAN_BEATED)
                    {
                        dialogueText.text += "\n\nIf you can drive off that annoying vegan lady outside I'll give you free burger.";
                        StaticObjects.FREE_CHEESEBURGER = true;
                    }
                    else
                    {
                        dialogueText.text += "\nGo get some money first.";
                    }
                }
            }
        }



        //WHEN YES PRESSED IN DIALOGUE
        if (isActive)
        {
            if (yes.getPressed() && !pressed)                //!!! DON'T CHANGE THIS && !pressed
            {
                pressed = true;

                //NEW SYSTEM
                switch (currentNpc)
                {
                case DialogueMap.VEGANVILLE_MAFIA:
                    if (StaticObjects.QUEST_FAKEDOCTOR == 0)
                    {
                        dialogueText.text = dialogueMap.GetDialogue(DialogueMap.VEGANVILLE_MAFIA + DialogueMap.STEP_1);
                        //questNPC.ChangeStatus (DialogueMap.STEP_2, false);
                        StaticObjects.MAFIA_STATUS      = DialogueMap.STEP_2;
                        StaticObjects.MAFIA_HASQUESTION = true;
                        StaticObjects.QUEST_FAKEDOCTOR += 1;
                        poison = new GameItem("poison", "poison");
                        gameController.player.inventory.AddItem(poison);
                        gameController.player.inventory.ListInventory();
                        StaticObjects.OBJECTIVE_FAKE_DOCTOR_HASQUESTION = true;
                        StaticObjects.OBJECTIVE_FAKE_DOCTOR_STATUS      = DialogueMap.STEP_1;
                        //GameObject.Find ("FakeDoctorObjectiveNPC").GetComponent<QuestNPC> ().hasQuestion = true; // del this later.
                        //GameObject.Find ("FakeDoctorObjectiveNPC").GetComponent<QuestNPC> ().questStatus = DialogueMap.STEP_1; // del this later,
                    }
                    else if (StaticObjects.QUEST_FAKEDOCTOR == 2)
                    {
                        gameController.player.wallet.AddMoney(1000);
                        dialogueText.text          = dialogueMap.GetDialogue(DialogueMap.VEGANVILLE_MAFIA + DialogueMap.STEP_3);
                        StaticObjects.MAFIA_STATUS = DialogueMap.STEP_4;
                    }
                    else
                    {
                        dialogueText.text = "Liar. Go do your job if wish to claim the reward.";
                    }
                    break;

                case DialogueMap.DOCTOR_DICK:
                    dialogueText.text = dialogueMap.GetDialogue(DialogueMap.DOCTOR_DICK + DialogueMap.STEP_1);
                    questNPC.ChangeStatus(DialogueMap.STEP_1, false);
                    StaticObjects.DOCTOR_DICK_STATUS      = DialogueMap.STEP_1;
                    StaticObjects.DOCTOR_DICK_HASQUESTION = false;
                    StaticObjects.GOT_MEDS = true;
                    if (StaticObjects.TALKED_TO_NANCY)
                    {
                        GameObject.Find("nurse1").GetComponent <QuestNPC> ().ChangeStatus(DialogueMap.DEFAULT, true);
                        StaticObjects.NURSE_NANCY_HASQUESTION = true;
                    }
                    break;

                case DialogueMap.NURSE_NANCY:
                    if (ObjectiveStatus == 0 && StaticObjects.GOT_MEDS)
                    {
                        medicine = new GameItem("medicine", "meds");
                        gameController.player.inventory.AddItem(medicine);
                        gameController.player.inventory.ListInventory();
                        ObjectiveStatus  += 1;
                        dialogueText.text = dialogueMap.GetDialogue(DialogueMap.NURSE_NANCY + DialogueMap.STEP_2);
                        questNPC.ChangeStatus(DialogueMap.STEP_3, false);
                        StaticObjects.NURSE_NANCY_STATUS      = DialogueMap.STEP_3;
                        StaticObjects.NURSE_NANCY_HASQUESTION = false;
                    }
                    else if (!StaticObjects.GOT_MEDS && !StaticObjects.TALKED_TO_NANCY)
                    {
                        dialogueText.text = dialogueMap.GetDialogue(DialogueMap.NURSE_NANCY + DialogueMap.STEP_1);
                        questNPC.ChangeStatus(DialogueMap.STEP_1, false);
                        StaticObjects.NURSE_NANCY_STATUS      = DialogueMap.STEP_1;
                        StaticObjects.NURSE_NANCY_HASQUESTION = false;
                        StaticObjects.TALKED_TO_NANCY         = true;
                    }
                    break;

                case DialogueMap.BAD_LUCK_BRIAN:
                    if (StaticObjects.QUEST_FAKEDOCTOR == 1)
                    {
                        StaticObjects.QUEST_FAKEDOCTOR += 1;
                        gameController.player.inventory.RemoveItem(poison);
                        gameController.player.inventory.ListInventory();
                        //StaticObjects.MAFIA_STATUS = DialogueMap.STEP_3;
                    }
                    break;
                }

                //OLD SYSTEM
                //Drug Buyer's Dialogue
                if (ObjectiveStatus == 2 && currentNpc.Equals("Drug Buyer"))
                {
                    gameController.player.inventory.RemoveItem(medicine);
                    gameController.player.inventory.ListInventory();
                    dialogueText.text = "Cool! You'll get 20$ for this junk\n\nIf you find more.. stuff.. to sell come see me.";
                    gameController.player.wallet.AddMoney(20);
                    ObjectiveStatus += 1;
                    gameController.ChangeObjective("Gain your daily 15000kcal");
                }
                else if (ObjectiveStatus != 2 && currentNpc.Equals("Drug Buyer"))
                {
                    dialogueText.text = "Liar!";
                }

                if (currentNpc.Equals("Man"))
                {
                    StaticObjects.OBJECTIVE_VEGAN_BEATED = true;
                    gameController.player.wallet.AddMoney(50);

                    /*GameItem key = new GameItem ("key", "key");
                     * gameController.player.inventory.AddItem (key);
                     * gameController.player.inventory.ListInventory ();*/
                }
            }

            //WHEN NO IS PRESSED IN DIALOGUE
            if (no.getPressed() && !pressed)
            {
                pressed = true;

                //Doctor Dick Dialogue
                if (currentNpc.Equals(DialogueMap.DOCTOR_DICK) && !StaticObjects.GOT_MEDS)
                {
                    dialogueText.text = "Sir. I Think You should reconsider.";
                }

                //Nurse Nancy Dialogue
                if (currentNpc.Equals(DialogueMap.NURSE_NANCY))
                {
                    dialogueText.text = "Ah...";
                }

                //Drug Buyer's Dialogue
                if (currentNpc.Equals("Drug Buyer"))
                {
                    dialogueText.text = "F**k you too Bobby..";
                }

                if (currentNpc.Equals("Man"))
                {
                    dialogueText.text = "Filthy meat lover...";
                }
                if (currentNpc.Equals(DialogueMap.VEGANVILLE_MAFIA))
                {
                    dialogueText.text = "Spineless beta male..";
                }
            }
        }
    }