Implemented research cost, tweaked some values.
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user