Inheritance: ImageEffectBase
示例#1
0
    void Awake()
    {
        if (GameObject.FindWithTag("RainbowManager"))
        {
            ColorShift rainbowManager = GameObject.FindWithTag("RainbowManager").GetComponent <ColorShift>();
            colorShift = rainbowManager;
        }

        if (loadFromExternal)
        {
            LoadCatalogData();
        }
        else
        {
            if (generateCatalog)
            {
                GenerateCatalog();
            }
            else
            {
                Debug.LogError("Catalog missing! Load from external, locate missing json, or generate from scratch.");
            }
        }


        if (playTesting)
        {
            GenerateStartingInventory();
        }

        GenerateAllItems();
    }
示例#2
0
 void Awake()
 {
     if (GameObject.FindWithTag("RainbowManager"))
     {
         if (GameObject.FindWithTag("RainbowManager") != this.gameObject)
         {
             ColorShift rainbowManager = GameObject.FindWithTag("RainbowManager").GetComponent <ColorShift>();
             for (int i = 0; i < targets.Length; i++)
             {
                 rainbowManager.AddRenderer(targets[i]);
             }
             Destroy(gameObject);
         }
     }
     else
     {
         nextColor    = currentColor + 1;
         nextStep     = stepTime + Time.time;
         targetStarts = new Color[targets.Length];
         for (int i = 0; i < targets.Length; i++)
         {
             targetStarts[i] = targets[i].material.GetColor("_Color");
         }
     }
 }
示例#3
0
        public static Color Shift(this Color color, ColorShift shift)
        {
            switch (shift)
            {
            case ColorShift.BGR:
                return(Color.FromArgb(255, color.B, color.G, color.R));

            case ColorShift.BRG:
                return(Color.FromArgb(255, color.B, color.R, color.G));

            case ColorShift.GBR:
                return(Color.FromArgb(255, color.G, color.B, color.R));

            case ColorShift.GRB:
                return(Color.FromArgb(255, color.G, color.R, color.B));

            case ColorShift.RBG:
                return(Color.FromArgb(255, color.R, color.B, color.G));

            case ColorShift.RGB:
                return(Color.FromArgb(255, color));

            default:
                return(Color.FromArgb(255, color));
            }
        }
示例#4
0
    // Start is called before the first frame update
    void Awake()
    {
        if (jinx.isMain)
        {
            CreatePuppet(jinx);
            jinx.puppetOn = true;
            jinx.puppet.UpdatePuppet(jinx.position, talkingDepth);


            //Create Rainbow UI effect
            rainbowManager = Instantiate(jinxColorShifter).GetComponent <ColorShift>();
            DontDestroyOnLoad(rainbowManager.gameObject);
            GameObject[] allUIFrames = GameObject.FindGameObjectsWithTag("UIFrame");
            for (int i = 0; i < allUIFrames.Length; i++)
            {
                rainbowManager.AddRenderer(GetRenderer(allUIFrames[i]));
            }

            rainbowManager.AddRenderer(jinx.puppet.puppetUnderlay);
        }
        LoadPassage(storyStart);
    }
示例#5
0
/* COLOR SCHEME
 *
 #A2BEFF #476EC7 #1C397E #C8D9FF #E4ECFF    -- blue (hue 240)
 #FFBC37 #C78B15 #7F5500 #FFD580 #FFEDC8    -- orange (hue 60)
 *
 *      base    dark    xdark   light   xlight
 *
 *     S36L100 S64-L78 S78-L49 S22B100 S11L100    -- blue (hue 222)
 *     S78L100 S89-L78 S100L50 S50L100 S22L100    -- orange (hue 40)
 */


        public static string GetColor(ColorType type, ColorVariant variant, ColorShift shift = ColorShift.None)
        {
            int hue        = (type == ColorType.Base ? 222 : 40);
            int saturation = 0;
            int luminosity = 0;

            switch (variant)
            {
            case ColorVariant.Base:
                saturation = 100;
                luminosity = 80;
                break;

            case ColorVariant.Dark:
                saturation = 50;
                luminosity = 50;
                break;

            case ColorVariant.XDark:
                saturation = 65;
                luminosity = 30;
                break;

            case ColorVariant.Light:
                saturation = 100;
                luminosity = 90;
                break;

            case ColorVariant.XLight:
                saturation = 100;
                luminosity = 95;
                break;

            default:
                throw new NotImplementedException();
            }

            if (type == ColorType.Accent)
            {
                saturation *= 2;
                if (saturation > 100)
                {
                    saturation = 100;
                }
            }

            switch (shift)
            {
            case ColorShift.SlightlyDarker:
                luminosity -= 2;
                break;

            case ColorShift.SlightlyLighter:
                luminosity += 2;
                break;

            default:
                // do nothing
                break;
            }

            Color color = ColorFromAhsb(100, hue, saturation / 100.0, luminosity / 100.0);

            return(String.Format("#{0:x2}{1:x2}{2:x2}", color.R, color.G, color.B));
        }