Exemple #1
0
        public static Texture2D Generate(int textureWidth, int textureHeight)
        {
            var stripes = new ChanceBox <int>();

            stripes.Add(1, 0.08f);
            stripes.Add(2, 0.3f);
            stripes.Add(3, 0.5f);
            stripes.Add(4, 0.05f);
            //stripes.Add(8, 0.01f);
            stripes.Initiate();

            int stripesAmount = stripes.GetRandom();
            int stripeSize    = textureWidth / stripesAmount;
            var res           = new Texture2D(textureWidth, textureHeight);


            int stripeNumber = 0;
            var color        = ColorExtensions.getRandomColor();

            Array values = Enum.GetValues(typeof(StripesDirection));

            StripesDirection stripeDirection = (StripesDirection)values.GetValue(Rand.Get.Next(values.Length));


            if (stripeDirection == StripesDirection.vertical)
            //Vertical stripes
            {
                for (int x = 0; x < textureWidth; x++)
                {
                    if (x > stripeSize * stripeNumber)
                    {
                        stripeNumber++;
                        color = ColorExtensions.getRandomColor();
                    }
                    for (int y = 0; y < textureHeight; y++)
                    {
                        res.SetPixel(x, y, color);
                    }
                }
            }
            else
            {
                for (int y = 0; y < textureHeight; y++)
                {
                    if (y > stripeSize * stripeNumber)
                    {
                        stripeNumber++;
                        color = ColorExtensions.getRandomColor();
                    }
                    for (int x = 0; x < textureHeight; x++)
                    {
                        res.SetPixel(x, y, color);
                    }
                }
            }
            res.Apply();
            return(res);
        }
Exemple #2
0
    public ProvinceNameGenerator()
    {
        postfix = new ChanceBox <string>();
        postfix.add("burg", 2.2f);
        postfix.add("bridge", 0.1f);
        postfix.add("coln", 0.2f);

        postfix.add("field", 2f);
        postfix.add("hill", 1f);
        postfix.add("ford", 0.5f);
        postfix.add("land", 2.5f);
        postfix.add("landia", 0.3f);
        postfix.add("lia", 2.5f);
        postfix.add("mia", 0.1f);
        postfix.add("stad", 0.3f);

        postfix.add("holm", 1f);
        postfix.add("bruck", 0.3f);
        postfix.add("bridge", 0.3f);
        postfix.add("berg", 1f);
        postfix.add(" Creek", 1f);
        postfix.add(" Lakes", 1.5f);
        postfix.add(" Falls", 1f);
        postfix.add("rock", 2f);
        postfix.add("ville", 2f);
        postfix.add("polis", 2f);
        postfix.add("", 10f);
        postfix.initiate();

        prefix = new ChanceBox <string>();
        prefix.add("Fort ", 0.5f);
        prefix.add("South ", 0.3f);
        prefix.add("West ", 0.3f);
        prefix.add("North ", 0.3f);
        prefix.add("East ", 0.3f);
        prefix.add("Saint ", 0.1f);
        prefix.add("Great ", 0.2f);
        prefix.add("Dark ", 0.01f);
        prefix.add("Upper ", 0.2f);
        prefix.add("Middle ", 0.1f);
        prefix.add("", 80f);
        prefix.initiate();

        vowels.add("a", 8.167f);
        vowels.add("e", 12.702f);
        vowels.add("i", 6.966f);
        vowels.add("o", 7.507f);
        vowels.add("u", 2.758f);
        vowels.add("a", 8.167f);
        vowels.initiate();

        consonants.add("b", 1.492f);
        consonants.add("c", 2.782f);
        consonants.add("d", 4.253f);

        consonants.add("f", 2.228f);
        consonants.add("g", 2.015f);
        consonants.add("h", 0.1f); //IRL -  6.094f);

        consonants.add("j", 0.153f);
        consonants.add("k", 0.772f);
        consonants.add("l", 4.025f);
        consonants.add("m", 2.406f);
        consonants.add("n", 6.749f);

        consonants.add("p", 1.929f);
        consonants.add("q", 0.095f);
        consonants.add("r", 5.987f);
        consonants.add("s", 6.327f);
        consonants.add("t", 9.056f);

        consonants.add("v", 0.978f);
        consonants.add("w", 2.360f);
        consonants.add("x", 0.150f);
        consonants.add("y", 1.974f);
        consonants.add("z", 0.074f);
        consonants.initiate();
    }