private void GetHSVColor()
        {
            ColorHSV colorhsv = new ColorHSV(colorSource.Value);

            HSV.Value = new Vector3(colorhsv.h,colorhsv.s,colorhsv.v);

            hue.Value = colorhsv.h;
            saturation.Value = colorhsv.s;
            value.Value = colorhsv.v;

            alpha.Value = colorhsv.a;
        }
        public override void OnEnter()
        {
            Color _col = new Color(Random.value, Random.value, Random.value);
            ColorHSV colorhsv = new ColorHSV(_col);
            colorhsv.h += Random.Range(0f,360f);
            Color result = colorhsv.ToColor();

            if (includeAlpha.Value)
            {
                result.a = Random.Range(0.1f,1f);
            }

            storeResult.Value = result;

            Finish();
        }
        private void SetHSVColor()
        {
            ColorHSV colorhsv = new ColorHSV(HSV.Value.x,HSV.Value.y,HSV.Value.z,alpha.Value);

            if (!hue.IsNone)
            {
                colorhsv.h = hue.Value;
            }
            if (!saturation.IsNone)
            {
                colorhsv.s = saturation.Value;
            }
            if (!value.IsNone)
            {
                colorhsv.v = value.Value;
            }

            colorResult.Value = colorhsv.ToColor();
        }
Example #4
0
        private void Generate()
        {
            automaton = new CellularAutomaton(width, height, ruleset, startNoise, aliveBorders);

            float hue = Random.value;
            deadColor = new ColorHSV(hue, deadCellSaturation, deadCellValue).ToColor();
            aliveColor = new ColorHSV(hue, aliveCellSaturation, aliveCellValue).ToColor();

            var backgroundColor = new ColorHSV(hue, backgroundSaturation, backgroundValue).complementary.ToColor();
            background.CrossFadeColor(backgroundColor, fadeDuration, true, false);
        }
        private void DrawEdge(Edge edge)
        {
            int x, y, width, height;
            if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Down)
            {
                x = Translate(edge.exit.x);
                y = Translate(edge.exit.y);
            }
            else
            {
                x = Translate(edge.origin.x);
                y = Translate(edge.origin.y);
            }

            if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Right)
            {
                width = cellSize*2 + wallSize;
                height = cellSize;
            }
            else
            {
                width = cellSize;
                height = cellSize*2 + wallSize;
            }

            Color color;
            if (useRainbowGradient)
            {
                float hue = Mathf.Repeat(edge.origin.depth/360f, 1);
                color = new ColorHSV(hue, 1, 1).ToColor();
            }
            else
            {
                color = Color.white;
            }
            texture.DrawRect(x, y, width, height, color);
        }
Example #6
0
        private IEnumerator GenerateCoroutine()
        {
            var algorithm = generatorAlgorithm;
            if (algorithm == MazeGenerator.Algorithm.None)
            {
                algorithm = RandomE.GetRandom(MazeGenerator.Algorithm.RandomTraversal,
                    MazeGenerator.Algorithm.RandomDepthFirstTraversal,
                    MazeGenerator.Algorithm.RandomBreadthFirstTraversal);
            }

            hue = Random.value;
            var backgroundColor = new ColorHSV(hue, backgroundSaturation, backgroundValue).complementary.ToColor();
            background.CrossFadeColor(backgroundColor, fadeDuration, true, false);

            switch (algorithm)
            {
                case MazeGenerator.Algorithm.RandomTraversal:
                    yield return StartCoroutine(mazeGenerator.RandomTraversal(DrawEdge, texture.Apply));
                    break;
                case MazeGenerator.Algorithm.RandomDepthFirstTraversal:
                    yield return StartCoroutine(mazeGenerator.RandomDepthFirstTraversal(DrawEdge, texture.Apply));
                    break;
                case MazeGenerator.Algorithm.RandomBreadthFirstTraversal:
                    yield return StartCoroutine(mazeGenerator.RandomBreadthFirstTraversal(DrawEdge, texture.Apply));
                    break;
            }
            texture.Apply();
        }
Example #7
0
        private void DrawEdge(Edge edge)
        {
            int x, y, width, height;
            if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Down)
            {
                x = Translate(edge.exit.x);
                y = Translate(edge.exit.y);
            }
            else
            {
                x = Translate(edge.origin.x);
                y = Translate(edge.origin.y);
            }

            if (edge.origin.direction == Directions.Left || edge.origin.direction == Directions.Right)
            {
                width = cellSize*2 + wallSize;
                height = cellSize;
            }
            else
            {
                width = cellSize;
                height = cellSize*2 + wallSize;
            }

            Color color;
            if (useGradient)
            {
                float gradient01 = Mathf.Repeat(edge.origin.depth/gradientLength, 1);
                float gradient010 = Mathf.Abs((gradient01 - 0.5f)*2);

                float saturation = gradient010*gradientSaturation + gradientSaturationOffset;
                float value = gradient010*gradientValue + gradientValueOffset;
                color = new ColorHSV(hue, saturation, value).ToColor();
            }
            else
            {
                color = Color.white;
            }
            texture.DrawRect(x, y, width, height, color);
        }
Example #8
0
 public ColorHSVAmount(ColorHSVAmount cHSVA)
 {
     colorHSV = cHSVA.colorHSV;
     amount = cHSVA.amount;
 }
Example #9
0
 /// <summary>
 /// Initializes a new instance of the ColorHSVAmount class.
 /// </summary>
 /// <param name="c">Color (in HSV).</param>
 /// <param name="a">Amount (should be between 0.0f and 1.0f).</param>
 public ColorHSVAmount(ColorHSV c, float a)
 {
     colorHSV = c;
     amount = a;
 }
Example #10
0
 public ColorHSV(ColorHSV cHSV)
 {
     h = cHSV.h;
     s = cHSV.s;
     v = cHSV.v;
     a = cHSV.a;
 }