示例#1
0
 // -------------------------------------------------------------------------------
 // getCurrencyAmount
 // -------------------------------------------------------------------------------
 public long getCurrencyAmount(_CurrencyTemplate _template)
 {
     return(currencies.FirstOrDefault(x => x.template == _template).amount);
 }
示例#2
0
 // -------------------------------------------------------------------------------
 // getCurrencyIndex
 // -------------------------------------------------------------------------------
 public int getCurrencyIndex(_CurrencyTemplate _template)
 {
     return(currencies.FindIndex(x => x.template == _template));
 }
示例#3
0
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
        // PUBLIC FUNCTIONS
        // - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

        // -------------------------------------------------------------------------------
        // addCurrency
        // -------------------------------------------------------------------------------
        public void addCurrency(_CurrencyTemplate _template, long _amount)
        {
            CurrencyInstance instance = new CurrencyInstance(game, _template, _amount);

            currencies.Add(instance);
        }
示例#4
0
 // -------------------------------------------------------------------------------
 // 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;
        }