示例#1
0
        public override void Apply(GameObject gameObject, string rightSide)
        {
            Color colorOverride = new HueSatLight(rightSide).AsRGB.ToUnityColor();

            Talespire.Log.Debug($"colorOverride: {colorOverride}");

            HandleRfx4ScriptColorChanges(gameObject, colorOverride);
            // TODO: Add more color changes for particle systems, other known scripts that impact color, etc.
        }
示例#2
0
        public void UpdateRingHue(int ringHue)
        {
            Talespire.Log.Warning($"Setting Data.RingHue to {ringHue}");
            Data.RingHue = ringHue;
            HueSatLight hueSatLight = new HueSatLight(ringHue / 360.0, 1, 0.5);

            System.Drawing.Color asRGB = hueSatLight.AsRGB;
            IndicatorColor = new Color(asRGB.R / 255.0f, asRGB.G / 255.0f, asRGB.B / 255.0f);
            RefreshIndicators();
        }
            static void SetTurnIndicatorColor(GameObject gameObject, string htmlColorStr, float creatureScale)
            {
                float multiplier = 1;

                Log.Debug($"htmlColorStr = \"{htmlColorStr}\"");
                HueSatLight hueSatLight;

                try
                {
                    hueSatLight = new HueSatLight(htmlColorStr);
                }
                catch (Exception ex)
                {
                    Log.Exception(ex);
                    htmlColorStr = "#ff0000";
                    hueSatLight  = new HueSatLight("#ff0000");
                }
                double relativeLuminance = hueSatLight.GetRelativeLuminance();

                Log.Debug($"hueSatLight.GetRelativeLuminance: {relativeLuminance}");
                if (relativeLuminance > 0.24)
                {
                    multiplier = 0.5f;
                }
                else if (relativeLuminance > 0.5)
                {
                    multiplier = 0.4f;
                }
                if (creatureScale < 1)
                {
                    multiplier *= 0.75f;
                }
                // relativeLuminance 1
                Property.ModifyColor(gameObject, "Particle System", "<ParticleSystemRenderer>.material._TintColor", $"{htmlColorStr} x{multiplier * 4f}");
                Property.ModifyColor(gameObject, "Decal_FireRing", "<MeshRenderer>.material._TintColor", $"{htmlColorStr} x{multiplier * 7f}");
            }