Implemented research cost, tweaked some values.

This commit is contained in:
2026-05-09 22:30:18 +02:00
parent fc21c7c8d3
commit 09df4334b9
8 changed files with 119 additions and 39 deletions
+16 -4
View File
@@ -15,10 +15,9 @@ public class Research
{
if (!paidResources)
{
foreach (Ingredient ingredient in data.Inputs)
{
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
}
if (!CanStart()) return ResearchResult.FAILED;
PayResources();
paidResources = true;
}
@@ -31,6 +30,19 @@ public class Research
return ResearchResult.RESEARCHING;
}
public bool CanStart()
{
return GameData.inventory.CanCraft(data.Inputs, 1);
}
public void PayResources()
{
foreach (Ingredient ingredient in data.Inputs)
{
GameData.inventory.RemoveItem(ingredient.Item, ingredient.Amount);
}
}
public void Complete()
{
if (state == ResearchState.RESEARCHED) return;