# Research

### Key Features

* **Management:** Provides module for managing player's completed research, updates player's global progression tracking.
* **Technology:** Research used as a simple requirement of other options/features available to entities or player himself.
* **Progression Tracking:** Easy to access progression defined on Player, managed by research.
* **Progression Research:** New research for levelling up entities or units. Optionally utilises the **Upgrade Module** to progress/upgrade entities.

***

### Structure

* **Research Module** - Tracks completed researches.
* **Research** - Defines a producible of research type.
* **Producible Progression Research** - Defines research used for progression of producibles, typically for upgrading one or more entity or unit types.

***

### Usage examples

Listening to completed researches for manual updates on UI or similar cases.

```csharp
if (!player.TryGetModule(out ResearchModule researchModule)) return;

// Add listener in Start or OnEnable methods
researchModule.OnResearchFinished.AddListener(HandleResearchFinished);

// ...

private void HandleResearchFinished(ResearchSO newResearch)
{
    // Handle your event here
}

```

When you want to manually reward the player a specific research or progression (like new age).

```csharp
ResearchSO myCustomResearch = // .. Set the research

if (!player.TryGetModule(out ResearchModule researchModule)) return;

// Check if you already added it.
if (researchModule.IsResearchComplete(myCustomResearch)) return;

// Add new research for the first time.
researchModule.AddFinishedResearch(myCustomResearch);
```

You can also remove the research like this

```csharp
if (!player.TryGetModule(out ResearchModule researchModule)) return;

researchModule.RemoveCompletedResearch(myCustomResearch);
```
