Example #1
0
    public override void PlayerInteracts(Player player)
    {
        base.PlayerInteracts(player);

        if (currentlyRelevantActionIDs.Count > selectedInteractionIndex)
        {
            switch (currentlyRelevantActionIDs [selectedInteractionIndex])
            {
            case actionID.TALK_TO:
                UI.instance.ShowDialogue(Dialogues.RetrieveDialogue(TimeLogic.day, characterId, DialogueID.GREETING) [0], portrait, characterId, Dialogues.RetrieveReward(TimeLogic.day, characterId, DialogueID.GREETING));


                if (characterId == Character.GRANDMA)
                {
                    Quests.instance.FulfilledQuestCondition(QuestTask.TALK_TO_GRANDMA);
                }

                break;

            case actionID.SELL:
                Equippable item = player.currentlyEquippedItem;
                PlayerEconomy.ReceiveMoney(Prices.GetPriceByID(player.currentlyEquippedItem.id));
                player.UnequipEquippedItem(false, true);
                Destroy(item.gameObject);
                break;
            }
        }
    }
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            if (currentIntroIndex >= introSteps)
            {
                SceneManager.LoadScene("main");
            }
            else
            {
                if (currentIntroIndex % 2 == 0)
                {
                    UI.instance.ShowDialogue(Dialogues.RetrieveDialogue(0, Character.GRANDMA, DialogueID.INTRO)[dialogueIndex], grandmaPortrait, Character.GRANDMA);
                    //GameObject.Find ("DebugText").GetComponent<Text> ().text = "ui instance: " + UI.instance.name + ". dialogueText is active: " + UI.instance.dialogueText.gameObject.activeSelf + ". this pos: " + GameObject.Find ("DebugText").transform.position + ". dialogue box pos: " + UI.instance.dialogueText.transform.position;
                }
                else
                {
                    UI.instance.ShowDialogue(Dialogues.RetrieveDialogue(0, Character.PLAYER, DialogueID.INTRO)[dialogueIndex], playerPortrait, Character.PLAYER);
                    //GameObject.Find ("DebugText").GetComponent<Text> ().text = Dialogues.RetrieveDialogue (0, Character.PLAYER, DialogueID.INTRO) [dialogueIndex];
                }

                ++currentIntroIndex;
                dialogueIndex = currentIntroIndex / 2;
            }
        }
    }