/// <summary> /// Checking if objective can be submitted /// </summary> /// <param name="objective"></param> private void TryToSubmitObjective(ObjectiveSO objective) { if (_currentQuest.Objective.Contains(objective) && CanAcceptObjective(objective)) { SubmitObjective(objective); } else { TooltipActionEvent?.Invoke(tooltipTextSO.WrongObjective); } }
/// <summary> /// Activate next quest in the list using button /// </summary> private void ActivateQuest() { if (_currentQuestIndex >= quests.Count) { TooltipActionEvent?.Invoke(tooltipTextSO.NoMoreQuest); return; } _currentQuest = quests[_currentQuestIndex]; _currentQuestIndex++; ChangeQuestActiveState(true); }
/// <summary> /// Add objective to the _submittedObjectives and check if quest can be finished /// </summary> /// <param name="objective"></param> private void SubmitObjective(ObjectiveSO objective) { _submittedObjectives.Add(objective); ObjectiveSubmittedEvent?.Invoke(); string endValue = string.Format(tooltipTextSO.ObjectiveSubmitted, objective.ObjectiveName); TooltipActionEvent?.Invoke(endValue); if (_submittedObjectives.Count == _currentQuest.Objective.Count) { FinishQuest(); } }
/// <summary> /// Change state of current quest /// </summary> /// <param name="newState"></param> private void ChangeQuestActiveState(bool newState) { _isQuestActive = newState; activateQuestButton.interactable = !newState; finishQuestButton.interactable = newState; objective1.interactable = objective2.interactable = objective3.interactable = newState; if (newState) { string endValue = string.Format(tooltipTextSO.QuestActive, _currentQuest.QuestName); QuestActiveEvent?.Invoke(_currentQuest); TooltipActionEvent?.Invoke(endValue); } else { string endValue = string.Format(tooltipTextSO.QuestFinished, _currentQuest.QuestName); QuestFinishedEvent?.Invoke(); TooltipActionEvent?.Invoke(endValue); } }