---
description: >-
  Presented by IQuestManager interface, this system provides functionality for
  processing quests.
---

# Quest Manager

To use this system, inject IQuestManager interface into your class, as shown below:

```csharp
[Inject] private IQuestManager questManager;
```

### Parameters in inspector

**questsCollection** – reference to scriptable object which contains quests collection (all available quests and initial quests list, separately).

### Available methods

```csharp
void StartQuest(string questId)
```

_This method starts quest by known **questId**. If this parameter is not correct or empty, this method will not do anything. **questId** string should have GUID format._

_Example:_

```csharp
questManager.StartQuest("99ec04ae-e322-4e8c-9409-f924aae4150a");
```

***

```csharp
void AddProgress(QuestTaskType questTaskType, int progress)
```

_This method increments progress of all active quests which have a certain task type._

_Examples:_

```csharp
questManager.AddProgress(QuestTaskType.GameWon, 1);
questManager.AddProgress(QuestTaskType.EnemiesDefeated, 1);
```

***

```csharp
QuestInfo GetQuestInfo(string questId)
```

_This method returns information about quest with certain ID._

_Example:_

```csharp
QuestInfo questInfo = questManager.GetQuestInfo("99ec04ae-e322-4e8c-9409-f924aae4150a");

Debug.Log("Quest title: " + questInfo.Title);
Debug.Log("Quest desc: " + questInfo.Description);
```

***

```csharp
QuestState GetQuestState(string questId)
```

_This method returns current state of quest with certain ID. You can use this to get information about quest progress._

_Example:_

```csharp
QuestState questState = questManager.GetQuestState(questId);

Debug.Log($"First task progress: {questState.QuestProgress[0]}");
```

***

```csharp
int GetQuestTaskProgress(string questId, QuestTaskType taskType)
```

_This method returns current progress for task **taskType** for quest with **questId**._

_Example:_

```csharp
int enemiesDefeated = questManager.GetQuestTaskProgress(questId, QuestTaskType.EnemiesDefeated);

Debug.Log($"Enemies defeated: {enemiesDefeated}");
```

***

```csharp
bool IsQuestCompleted(string questId)
```

_This method returns **true**, if quest is completed, otherwise it returns **false**._

***

```csharp
bool IsQuestActive(string questId)
```

_This method returns **true**, if quest was started and is currently running._
