Ejemplo n.º 1
0
 public void AddTokensToElement(TokenDefinition token, ElementInstance element, int amount)
 {
     if (amount >= 0 && amount <= GetTokenAmount(token))
     {
         element.AddTokens(token, Id, amount);
         AddTokens(token, Id, -amount);
     }
 }
Ejemplo n.º 2
0
        public void SetTokensToElement(TokenDefinition token, ElementInstance element, int amount)
        {
            if (amount < 0)
            {
                return;
            }
            int currentAmount = element.GetTokenAmount(token, Id);
            int diff          = amount - currentAmount;

            if (diff <= GetTokenAmount(token))
            {
                element.AddTokens(token, Id, diff);
                AddTokens(token, Id, -diff);
            }
        }