[Fix] ScoringSystem
This commit is contained in:
@@ -5,6 +5,7 @@ using UnityEngine;
|
||||
using VContainer;
|
||||
using YachtDice.Categories;
|
||||
using YachtDice.Dice;
|
||||
using YachtDice.Economy;
|
||||
using YachtDice.Events;
|
||||
using YachtDice.Modifiers.Core;
|
||||
using YachtDice.Modifiers.Runtime;
|
||||
@@ -23,13 +24,19 @@ namespace YachtDice.Scoring
|
||||
private GameEventBus _eventBus;
|
||||
private ModifierRegistry _modifierRegistry;
|
||||
private CategoryCatalog _catalog;
|
||||
private CurrencyBank _currencyBank;
|
||||
|
||||
[Inject]
|
||||
public void Construct(GameEventBus eventBus, ModifierRegistry modifierRegistry, CategoryCatalog catalog)
|
||||
public void Construct(
|
||||
GameEventBus eventBus,
|
||||
ModifierRegistry modifierRegistry,
|
||||
CategoryCatalog catalog,
|
||||
CurrencyBank currencyBank)
|
||||
{
|
||||
this._eventBus = eventBus;
|
||||
this._modifierRegistry = modifierRegistry;
|
||||
this._catalog = catalog;
|
||||
this._currencyBank = currencyBank;
|
||||
}
|
||||
|
||||
public CategoryCatalog Catalog => _catalog;
|
||||
@@ -109,6 +116,9 @@ namespace YachtDice.Scoring
|
||||
_scorecard[category] = finalScore;
|
||||
_usedCategories.Add(category);
|
||||
|
||||
if (context.CurrencyDelta != 0 && _currencyBank != null)
|
||||
_currencyBank.Add(context.CurrencyDelta);
|
||||
|
||||
OnCategoryScored?.Invoke(category, finalScore);
|
||||
OnCategoryConfirmed?.Invoke(category, result);
|
||||
|
||||
@@ -147,6 +157,9 @@ namespace YachtDice.Scoring
|
||||
_scorecard[category] = finalScore;
|
||||
_usedCategories.Add(category);
|
||||
|
||||
if (context != null && context.CurrencyDelta != 0 && _currencyBank != null)
|
||||
_currencyBank.Add(context.CurrencyDelta);
|
||||
|
||||
OnCategoryScored?.Invoke(category, finalScore);
|
||||
OnCategoryConfirmed?.Invoke(category, result);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user