Ejemplo n.º 1
0
        internal PRemoteLightWrapper(object other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }
            if (!PPatchTools.TryGetPropertyValue(other, nameof(ILightShape.KleiLightShape),
                                                 out LightShape ls))
            {
                throw new ArgumentException("Light shape is missing KleiLightShape");
            }
            KleiLightShape = ls;
            if (!PPatchTools.TryGetPropertyValue(other, nameof(ILightShape.Identifier),
                                                 out string id) || id == null)
            {
                throw new ArgumentException("Light shape is missing KleiLightShape");
            }
            Identifier = id;
            if (!PPatchTools.TryGetPropertyValue(other, nameof(ILightShape.RayMode),
                                                 out LightShape rm))
            {
                rm = (LightShape)(-1);
            }
            RayMode = rm;
            var otherType = other.GetType();

            fillLight = otherType.CreateDelegate <FillLightDelegate>(nameof(PLightShape.
                                                                            DoFillLight), other, typeof(GameObject), typeof(int), typeof(int),
                                                                     typeof(BrightnessDict));
            if (fillLight == null)
            {
                throw new ArgumentException("Light shape is missing FillLight");
            }
        }