Esempio n. 1
0
    internal void EndQuest()
    {
        Quests[_questIndex].Completed = true;
        SaveQuest();
        Color color;

        if (!ColorUtility.TryParseHtmlString("#92FF00FF", out color))
        {
            return;
        }
        if (_nextButton.interactable)
        {
            _nextButton.image.color = color;
            StartCoroutine(_videoHandler.AutoPlay());
        }

        if (_previousButton.interactable)
        {
            _previousButton.image.color = color;
        }

        // Check achievement Conditions
        if (Quests.All(quest => quest.Completed))
        {
            ProgressManager.Instance.UnlockAchievement(CommonResources.IdOf(Reward), 100);
            if (_nextButton.interactable)
            {
                return;
            }
            Invoke("Back", 1.5f);
        }
        else if (!_nextButton.interactable)
        {
            CloseQuestion();
            _videoHandler.Stop();
            _questIndex = Array.FindIndex(Quests, quest => !quest.Completed);
            InitiateQuest();
        }
    }