public static void AddLoot(Tile target, EnemyDropCategory Category) { LootConfig conf = LootBalance.GetBalance().GetLootConfig(Category); if (conf != null && target.GetComponent <Tile_Loot>() == null) { target.gameObject.AddComponent <Tile_Loot>().SetLoot(conf); } }
public LootConfig GetLootConfig(EnemyDropCategory drop) { if (drop == EnemyDropCategory.none) { return(null); } EnemyDropConfig edc = EnemyDropConfigs.FirstOrDefault(config => config.Category == drop); if (edc != null && edc.DropChance >= UnityEngine.Random.value) { return(M_Weightable.GetWeighted(edc.Configs).config); } else { Debug.LogWarning("Could not find enemy drop config for " + drop + " configs=" + EnemyDropConfigs.Count); return(null); } }
public void Init(Unit u, EnemyDropCategory category) { cat = category; m_unit = u; Unit.OnUnitKilled += OnDeath; }