Beispiel #1
0
    public static Color getColor(peblesColors colors)
    {
        switch (colors)
        {
        case peblesColors.BLUE:
            return(Color.blue);

        case peblesColors.BROWN:
            return(new Color(0.568f, 0.203f, 0.031f));

        case peblesColors.GREEN:
            return(Color.green);

        case peblesColors.RED:
            return(Color.red);

        case peblesColors.YELLOW:
            return(Color.yellow);

        case peblesColors.PURPLE:
            return(new Color(0.611f, 0.086f, 0.713f));
        }
        return(Color.red);
    }
Beispiel #2
0
    private Color getRandomColor(peblesColors color)
    {
        switch (color)
        {
        case peblesColors.BLUE:
            if (Random.value > 0.6)
            {
                return(Color.blue);
            }
            break;

        case peblesColors.BROWN:
            if (Random.value > 0.6)
            {
                return(new Color(0.568f, 0.203f, 0.031f));
            }
            break;

        case peblesColors.GREEN:
            if (Random.value > 0.6)
            {
                return(Color.green);
            }
            break;

        case peblesColors.RED:
            if (Random.value > 0.6)
            {
                return(Color.red);
            }
            break;

        case peblesColors.YELLOW:
            if (Random.value > 0.6)
            {
                return(Color.yellow);
            }
            break;

        case peblesColors.PURPLE:
            if (Random.value > 0.6)
            {
                return(new Color(0.611f, 0.086f, 0.713f));
            }
            break;
        }
        float value = Random.value * 10;

        // Return non primary colors
        if (value < 2)
        {
            return(Color.blue);
        }
        else if (value < 4)
        {
            return(new Color(0.611f, 0.086f, 0.713f));
        }
        else if (value < 6)
        {
            return(Color.yellow);
        }
        else if (value < 8)
        {
            return(Color.green);
        }
        else if (value < 10)
        {
            return(new Color(0.568f, 0.203f, 0.031f));
        }

        return(Color.red);
    }