Beispiel #1
0
 // Setup + Initialization
 #region
 public void RunSetupFromLootDataSO(LootDataSO data)
 {
     myLootData           = data;
     nameText.text        = data.lootName;
     descriptionText.text = data.lootDescription;
     rewardImage.sprite   = data.lootImage;
 }
Beispiel #2
0
    public LootDataSO GetLootRewardByName(string name)
    {
        LootDataSO lootReturned = null;

        foreach (LootDataSO loot in allLootRewards)
        {
            if (loot.lootName == name)
            {
                lootReturned = loot;
                break;
            }
        }

        return(lootReturned);
    }
    public List <LootDataSO> GetThreeRandomDifferentLootRewards()
    {
        List <LootDataSO> lootRewardsReturned = new List <LootDataSO>();
        LootDataSO        one   = null;
        LootDataSO        two   = null;
        LootDataSO        three = null;

        one = LootLibrary.Instance.GetRandomLootData();
        while (two == null || two == one)
        {
            two = LootLibrary.Instance.GetRandomLootData();
        }
        while (three == null || three == two || three == one)
        {
            three = LootLibrary.Instance.GetRandomLootData();
        }

        lootRewardsReturned.Add(one);
        lootRewardsReturned.Add(two);
        lootRewardsReturned.Add(three);
        return(lootRewardsReturned);
    }
    public void RewardLootFromLootCard(LootDataSO lootData)
    {
        // Gold Supplies
        if (lootData.lootName == "Gold Supplies")
        {
            PlayerDataManager.Instance.ModifyGold(5);
        }

        // Medical Supplies
        else if (lootData.lootName == "Medical Supplies")
        {
            foreach (Defender defender in DefenderManager.Instance.allDefenders)
            {
                defender.ModifyCurrentHealth(5);
            }
        }

        // Food Supplies
        else if (lootData.lootName == "Food Supplies")
        {
            PlayerDataManager.Instance.ModifyCurrentMaxTroopCount(2);
        }
    }