예제 #1
0
    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);
        }
    }
예제 #2
0
    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);
        }
    }
예제 #3
0
 public void Init(Unit u, EnemyDropCategory category)
 {
     cat                = category;
     m_unit             = u;
     Unit.OnUnitKilled += OnDeath;
 }