Пример #1
0
        public void FromXYZ(XYZ color)
        {
            isOut = false;

            double rn = 3.2406 * color.X + -1.5372 * color.Y + -0.4986 * color.Z;
            double gn = -0.9689 * color.X + 1.8758 * color.Y + 0.0415 * color.Z;
            double bn = 0.0557 * color.X + -0.2040 * color.Y + 1.0570 * color.Z;

            r = (int)Math.Ceiling(F(rn) * 255);
            g = (int)Math.Ceiling(F(gn) * 255);
            b = (int)Math.Ceiling(F(bn) * 255);

            if (r < 0)
            {
                r     = 0;
                isOut = true;
            }

            if (g < 0)
            {
                g     = 0;
                isOut = true;
            }

            if (b < 0)
            {
                b     = 0;
                isOut = true;
            }


            if (r > 255)
            {
                r     = 255;
                isOut = true;
            }
            if (g > 255)
            {
                g     = 255;
                isOut = true;
            }
            if (b > 255)
            {
                b     = 255;
                isOut = true;
            }



            if (isOut)
            {
                ShowMessage?.Invoke(null, null);
            }
            else
            {
                DisableMessage?.Invoke(null, null);
            }

            ColorMustUpdate?.Invoke(null, null);
        }
    // Start is called before the first frame update
    void Start()
    {
        TransformMessage transformMsg = new TransformMessage(transformToUpdate);

        server.sendMessage(transformMsg);

        DisableMessage enableMsg = new DisableMessage();

        enableMsg.objToEnable = "Cube";
        server.sendMessage(enableMsg);
    }