Esempio n. 1
0
    public void ShowPlayerDeck()
    {
        DeletePlayerDeck();
        IEnumerator removeCoroutine = removePanel.AnimateIn();

        //modalPanel.panelsToAnimate.Clear();
        for (int i = 0; i < deck.Length; i++)
        {
            GameObject card = Instantiate(deck[i], removeCardSpawns[i].point);
            removeCardSpawns[i].card    = card;
            removeCardSpawns[i].hasCard = true;
            //modalPanel.panelsToAnimate.Add(card);
        }
        removePanel.StartCoroutine(removeCoroutine);
    }
Esempio n. 2
0
    void GenerateReward()
    {
        //Debug.Log("Generate Reward");
        modalPanel.panelsToAnimate.Clear();
        int spawnCount = 0;

        //CardGenerator.instance.LoadCards();
        for (int i = 0; i < rewardSpawns.Length; i++)
        {
            //Debug.Log("Loop: " + i);
            //for some reason this ran 3 times during testing, so we're just going to check to make sure we aren't spawning duplicates
            if (!rewardSpawns[i].hasCard)
            {
                //if it's been 4 or more rounds since we saw a rare
                if (PlayerStats.instance.rarePityTimer >= rareLimit)
                {
                    //generate a rare card and put it in our list of rewards
                    GameObject card = CardGenerator.instance.GenerateCard(CardRarity.Rare, true);
                    GameObject temp = Instantiate(card, rewardSpawns[i].point);
                    rewardSpawns[i].card    = temp;
                    rewardSpawns[i].hasCard = true;
                    //reset pity timer
                    PlayerStats.instance.rarePityTimer = 0;
                    spawnedRare = true;
                    spawnCount++;
                    //add cards to list of things to disable
                    //modalPanel.thingsToDisable.Add(temp);
                }
                //if it's been two or more rounds since we saw an uncommon
                else if (PlayerStats.instance.uncommonPityTimer >= uncommonLimit)
                {
                    //Generate an uncommon card and put it in our list of rewards
                    GameObject card = CardGenerator.instance.GenerateCard(CardRarity.Uncommon, true);
                    GameObject temp = Instantiate(card, rewardSpawns[i].point);
                    rewardSpawns[i].card    = temp;
                    rewardSpawns[i].hasCard = true;
                    //reset pity timer
                    PlayerStats.instance.uncommonPityTimer = 0;
                    spawnedUncommon = true;
                    //add card to list of things to disable
                    //modalPanel.thingsToDisable.Add(temp);
                }
                else
                {
                    //get a number between 1 and 100
                    int rand = Random.Range(1, 101);
                    if (rand < commonPercentage)
                    {
                        //Generate an uncommon card and put it in our list of rewards
                        GameObject card = CardGenerator.instance.GenerateCard(CardRarity.Common, true);
                        GameObject temp = Instantiate(card, rewardSpawns[i].point);
                        rewardSpawns[i].card    = temp;
                        rewardSpawns[i].hasCard = true;
                        //add card to list of things to disable
                        //modalPanel.thingsToDisable.Add(temp);
                    }
                    else if (rand > commonPercentage && rand < commonPercentage + uncommonPercentage)
                    {
                        //Generate an uncommon card and put it in our list of rewards
                        GameObject card = CardGenerator.instance.GenerateCard(CardRarity.Uncommon, true);
                        GameObject temp = Instantiate(card, rewardSpawns[i].point);
                        rewardSpawns[i].card    = temp;
                        rewardSpawns[i].hasCard = true;
                        //reset pity timer
                        PlayerStats.instance.uncommonPityTimer = 0;
                        spawnedUncommon = true;
                        //add card to list of things to disable
                        //modalPanel.thingsToDisable.Add(temp);
                    }
                    else
                    {
                        //generate a rare card and put it in our list of rewards
                        GameObject card = CardGenerator.instance.GenerateCard(CardRarity.Rare, true);
                        GameObject temp = Instantiate(card, rewardSpawns[i].point);
                        rewardSpawns[i].card    = temp;
                        rewardSpawns[i].hasCard = true;
                        //reset pity timer
                        PlayerStats.instance.rarePityTimer = 0;
                        spawnedRare = true;
                        //add card to list of things to disable
                        //modalPanel.thingsToDisable.Add(temp);
                    }
                }
            }
        }
        //show the cards
        //Debug.Log("Animate rewards in");
        IEnumerator rewardCoroutine = rewardPanel.AnimateIn();

        rewardPanel.StartCoroutine(rewardCoroutine);
        //update pity timers
        if (!spawnedRare)
        {
            PlayerStats.instance.rarePityTimer++;
        }
        if (!spawnedUncommon)
        {
            PlayerStats.instance.uncommonPityTimer++;
        }
    }