Пример #1
0
    public IEnumerator Talk()
    {
        if (!talking)
        {
            if (complete)
            {
                talking = true;
                uiManager.AddItem(reward, playerController.GetInventory().Count);
                playerController.AddItem(reward);
                if (!talkedTo)
                {
                    yield return(uiManager.Speak(npcName, message2));
                }
                yield return(uiManager.Speak(npcName, message3));

                soundManager.PlaySound(soundManager.complete);
                ScoreManager.AddPuzzleSolving(5);
                if (this is QuestFetch)
                {
                    questManager.AddSideQuest($"Bring {npcName} {GetComponent<QuestFetch>().item}");
                    questManager.Event("Complete a fetch quest", 0, true);
                    questManager.Event($"Bring {npcName} {GetComponent<QuestFetch>().item}", 1, true);
                }
                else if (this is QuestDefeat)
                {
                    questManager.AddSideQuest($"Save {npcName} from the {GetComponent<QuestDefeat>().enemy}");
                    questManager.Event("Complete a defeat quest", 0, true);
                    questManager.Event($"Save {npcName} from the {GetComponent<QuestDefeat>().enemy}", 1, true);
                }
                else if (this is QuestRescue)
                {
                    questManager.AddSideQuest($"Rescue {npcName}");
                    questManager.Event("Complete a rescue quest", 0, true);
                    questManager.Event($"Rescue {npcName}", 1, true);
                }

                StartCoroutine(Disappear());
            }
            else
            {
                talking  = true;
                talkedTo = true;
                yield return(uiManager.Speak(npcName, message));

                if (this is QuestFetch)
                {
                    questManager.AddSideQuest($"Bring {npcName} {GetComponent<QuestFetch>().item}");
                }
                else if (this is QuestDefeat)
                {
                    questManager.AddSideQuest($"Save {npcName} from the {GetComponent<QuestDefeat>().enemy}");
                }
                else if (this is QuestRescue)
                {
                    questManager.AddSideQuest($"Rescue {npcName}");
                }
                talking = false;
            }
        }
    }