// ------------------------------------------------------------------------------- // getCurrencyAmount // ------------------------------------------------------------------------------- public long getCurrencyAmount(_CurrencyTemplate _template) { return(currencies.FirstOrDefault(x => x.template == _template).amount); }
// ------------------------------------------------------------------------------- // getCurrencyIndex // ------------------------------------------------------------------------------- public int getCurrencyIndex(_CurrencyTemplate _template) { return(currencies.FindIndex(x => x.template == _template)); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // PUBLIC FUNCTIONS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ------------------------------------------------------------------------------- // addCurrency // ------------------------------------------------------------------------------- public void addCurrency(_CurrencyTemplate _template, long _amount) { CurrencyInstance instance = new CurrencyInstance(game, _template, _amount); currencies.Add(instance); }
// ------------------------------------------------------------------------------- // hasCurrency // ------------------------------------------------------------------------------- public bool hasCurrency(_CurrencyTemplate _template) { return(currencies.Exists(x => x.template == _template)); }
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // PUBLIC FUNCTIONS // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - // ------------------------------------------------------------------------------- // Constructor // ------------------------------------------------------------------------------- public CurrencyInstance(GameManager _game, _CurrencyTemplate template, long _amount) : base(_game) { hash = template.name.GetDeterministicHashCode(); amount = _amount; }