예제 #1
0
        public RollResult Roll(float chanceScalar, int wave)
        {
            RollResult result = new RollResult();

            foreach (LootItem item in _items)
            {
                int amount = item.Roll(chanceScalar, wave);
                if (amount != 0)
                {
                    result.Add(item.Prefab, amount);
                }
            }
            return(result);
        }
예제 #2
0
 private void OnEnemyKilled(IEnemy obj)
 {
     if (obj.WaveHandler && obj is Component component)
     {
         RollResult result = GetTable().Roll(BASE_FRACTION / (float)obj.WaveHandler.Amount, obj.WaveHandler.Wave);
         foreach (var pair in result)
         {
             for (int i = 0; i < pair.Value; i++)
             {
                 InstantiateLoot(pair.Key, component.transform.position);
             }
         }
     }
     obj.OnKilled -= OnEnemyKilled;
 }