Пример #1
0
        private void Awake()
        {
            // Assign the Animator Component.
            CharacterAnimator = characterEntity.GetComponent <Animator>();

            akd = GetComponentInChildren <ActionKeyDialog>();
            string[] arr        = { Application.dataPath, "Text", Grid.optionsManager.lang, SceneManager.GetActiveScene().name, DialogueDir };
            string   dialogPath = string.Join("/", arr);

            akd.getDialogueFiles(dialogPath);
            // TODO update dialogue with player's name
        }
Пример #2
0
        void Awake()
        {
            // Assign the Animator Component.
            CharacterAnimator = characterEntity.GetComponent <Animator>();

            // Adjust NPC facing
            Turn(InitialFacing);

            // Set the dialogue system
            akd = GetComponentInChildren <ActionKeyDialog>();
            string[] arr = { Application.dataPath, "Text", Grid.optionsManager.lang, SceneManager.GetActiveScene().name, DialogueDirectory };
            dialogPath = string.Join("/", arr);
            akd.getDialogueFiles(dialogPath);
        }
Пример #3
0
        public void Interact()
        {
            if (akd.DialoguePlaying())
            {
                akd.CreateDialogue();
                // There should be only one line of dialogue, so we can make it true here
                itemObtained = true;
            }
            else
            {
                if (possessedAmount > 0)
                {
                    int amount = possessedAmount >= obtainedAmount ? obtainedAmount : possessedAmount;
                    Grid.inventory.AddItem(itemID, amount);
                    possessedAmount -= amount;

                    if (sharedItem)
                    {
                        // Update the shared interactables
                        foreach (var shared in sharedWith)
                        {
                            shared.possessedAmount -= amount;
                        }
                    }

                    Grid.soundManager.PlaySound(Grid.itemDataBase.FetchItemByID(itemID).PickUpSound);

                    string[] arr        = { Application.dataPath, "Text", Grid.optionsManager.lang, "General", "getItem" };
                    string   dialogPath = string.Join("/", arr);
                    akd.getDialogueFiles(dialogPath);
                    // Replace text with item information
                    // In theory, only 1 string
                    for (int i = 0; i < akd.dialogue.Length; i++)
                    {
                        for (int j = 0; j < akd.dialogue[i].Length; j++)
                        {
                            akd.dialogue[i][j] = akd.dialogue[i][j].Replace(AMOUNT, amount.ToString());
                            akd.dialogue[i][j] = akd.dialogue[i][j].Replace(NAME, Grid.itemDataBase.FetchItemByID(itemID).Name_en);
                        }
                    }

                    interacted.Invoke();

                    akd.CreateDialogue();
                }
            }
        }