U
U
Uncle Bogdan2021-06-22 15:21:42
C++ / C#
Uncle Bogdan, 2021-06-22 15:21:42

How to properly open cases like in brawl stars?

Supposedly I created a class and the parameters of the chest are there, but how can they all be short and beautiful?

The code
using UnityEngine;

class Box
{
    int CoinsChance;
    int CoinsRange;

    int PowerPointChance;
    int PowerPointRange;

    int RareBrawler;
    int SuperRareBrawler;
    int EpicBrawler;
    int MythicalBrawler;
    int LegendaryBrawler;
    int ChromaticBrawler;

    int StarPowerChance;
    int GadgetChance;

    int BonusChance;

    Box() // я только сейчас понял что указывать все переменные будет ОЧЕНЬ длино
    {

    }
}

public class casinoBrawl : MonoBehaviour
{
    Box FreeBox = new Box();
}

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
Mixer1111, 2021-06-22
@motkot

I would suggest generating a random number from 0 to 100, and then check by the chances to see if the dropped number is less than the chance number. For example: The
chance to drop a hero is 20% overall. You throw out a random number from 0 to 100, and then you check - "the random number that has fallen out is less than a chance (for example, 20) for a hero to drop out?" and if not, the hero did not drop out, but if so, then you throw out a new number from 0 to the number of heroes of everything that decides which hero you will get
. to
the most frequent rarity

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question