Exemplo n.º 1
0
    public Lootbox CreateLootbox(int size = 3)
    {
        Lootbox lb = new Lootbox(size);

        for (int i = 0; i < size; i++)
        {
            var         r           = RarityHelper.GetWeightedRarity();
            LootboxItem item        = null;
            int         retardCheck = 0;
            do
            {
repeat:
                item = PotentialRewards.RandomElement(x => x.Rarity == r);
                if (item.RewardType == LootboxRewardType.Generators && !Services.TransportService.HasUnits(item.TargetGenerator))
                {
                    goto repeat;
                }
                r--; // if not item of that rarity was found, go one lower
                retardCheck++;

                if (retardCheck > 10)
                {
                    break;
                }
            } while (item == null && r > 0);

            lb[i] = item;
        }

        return(lb);
    }
Exemplo n.º 2
0
    private void FixedUpdate()
    {
        var color = RarityHelper.GetRarityColor(Rarity);

        Icon.sprite = Sprite;

        DescText.color     = color;
        LightEmitter.color = color;
        LightRay.color     = color;
    }
Exemplo n.º 3
0
 private void ActivateLootboxItem(LootboxItem lbi, LootboxItemView view)
 {
     if (lbi == null)
     {
         //TEMP placeholders
         lbi          = new LootboxItem();
         lbi.Rarity   = RarityHelper.GetWeightedRarity();
         lbi.DescText = "Temp Item";
     }
     view.Rarity        = lbi.Rarity;
     view.DescText.text = lbi.DescText;
     view.Sprite        = lbi.Icon;
     view.gameObject.SetActive(true);
 }