Exemple #1
0
            // Converts enum to real world color
            public static Color GetRealColor(EColor_Value RequestedColor)
            {
                switch (RequestedColor)
                {
                case EColor_Value.RED:
                    return(Color_R);

                case EColor_Value.YELLOW:
                    return(Color_Y);

                case EColor_Value.BLUE:
                    return(Color_B);

                case EColor_Value.ORANGE:
                    return(Color_O);

                case EColor_Value.GREEN:
                    return(Color_G);

                case EColor_Value.PURPLE:
                    return(Color_P);
                }
                Debug.LogError("You should not reach here");
                return(new Color());
            }
Exemple #2
0
    private void FillPlatform(EColor_Value fillColor)
    {
        EColor_Value mixedColor = ColorHelper.AddColors(currentColor, fillColor); //mix the current color with the color received

        currentColor = mixedColor;                                                //set the new mixed color as current
        Color resultColor = ColorHelper.GetRealColor(currentColor);               //convert enum to color

        OwnedMaterial.SetColor("_Color", resultColor);                            //apply to material
    }
Exemple #3
0
    private void OnTriggerEnter(Collider other)
    {
        //if block enter
        if (other.tag.Equals("ColorBlock"))
        {
            if (!isColorMixable) //ignore if already mixed
            {
                return;
            }

            EColor_Value BlockColor = other.GetComponent <ColorBlockScript>().GetColorValue; //get the color of the block
            FillPlatform(BlockColor);                                                        //apply the color
            StartCoroutine(StartDelayWindow());                                              //begin closing the window for a second color
        }
    }
Exemple #4
0
            // Adds two colors and returns the combined color
            public static EColor_Value AddColors(EColor_Value Color1, EColor_Value Color2)
            {
                switch (Color1) //check all possible combinations with the first color
                {
                case EColor_Value.RED:
                {
                    if (Color2 == EColor_Value.NONE)
                    {
                        return(Color1);
                    }
                    else if (Color2 == EColor_Value.RED)         //red + red
                    {
                        return(EColor_Value.RED);
                    }
                    else if (Color2 == EColor_Value.YELLOW)         //red + yellow
                    {
                        return(EColor_Value.ORANGE);
                    }
                    else if (Color2 == EColor_Value.BLUE)         // red + blue
                    {
                        return(EColor_Value.PURPLE);
                    }

                    break;
                }

                case EColor_Value.YELLOW:
                {
                    if (Color2 == EColor_Value.NONE)
                    {
                        return(Color1);
                    }
                    else if (Color2 == EColor_Value.RED)         // yellow + red
                    {
                        return(EColor_Value.ORANGE);
                    }
                    else if (Color2 == EColor_Value.YELLOW)         // yellow + yellow
                    {
                        return(EColor_Value.YELLOW);
                    }
                    else if (Color2 == EColor_Value.BLUE)         //yellow + blue
                    {
                        return(EColor_Value.GREEN);
                    }

                    break;
                }

                case EColor_Value.BLUE:
                {
                    if (Color2 == EColor_Value.NONE)
                    {
                        return(Color1);
                    }
                    else if (Color2 == EColor_Value.RED)         // blue + red
                    {
                        return(EColor_Value.PURPLE);
                    }
                    else if (Color2 == EColor_Value.YELLOW)         // blue + yellow
                    {
                        return(EColor_Value.GREEN);
                    }
                    else if (Color2 == EColor_Value.BLUE)         //blue + blue
                    {
                        return(EColor_Value.BLUE);
                    }

                    break;
                }

                case EColor_Value.NONE:     //if getting normal color
                {
                    if (Color2 == EColor_Value.RED)
                    {
                        return(EColor_Value.RED);
                    }
                    else if (Color2 == EColor_Value.YELLOW)
                    {
                        return(EColor_Value.YELLOW);
                    }
                    else if (Color2 == EColor_Value.BLUE)
                    {
                        return(EColor_Value.BLUE);
                    }

                    break;
                }
                }

                Debug.LogError("You are not supposed to reach here.");
                return(EColor_Value.NONE);
            }