Ejemplo n.º 1
0
    void GenerateHuman(Human human)
    {
        int randomNumber = (int)MyRandom.RandomGaussianUnity(averageTraits + (Engine.instance.playerLevel - 1) * averageIncrement, 1);

        randomNumber = Mathf.Clamp(randomNumber, minimunTraits, maximamTraits);
        Debug.Log(randomNumber);

        int count = 0;

        while (true)
        {
            if (randomNumber == human.traits.Count || human.traits.Count == traits.Count)
            {
                break;
            }

            Trait potentialTrait = traits[Random.Range(0, traits.Count)];
            if (potentialTrait.GetRarityForAppearanceProbability() >= Random.Range(0f, 1f))
            {
                human.traits.Add(potentialTrait);
            }

            count++;

            if (count > 300)
            {
                break;
            }
        }
    }