public MyLightProperties(Vector4 color, Vector3 specularColor, float fallOff, float range, float intensity, float pointLightOffSet, Vector4 reflectorColor,
     float reflectorFallOff, float reflectorRange, float reflectorIntensity, float reflectorConeDegrees, MyLight.LightTypeEnum lightType, MyPrefabLight prefabLight, float flashOffset)
 {
     Color = color;
     SpecularColor = specularColor;
     FallOff = fallOff;
     Range = range;
     Intensity = intensity;
     PointLightOffSet = pointLightOffSet;
     ReflectorColor = reflectorColor;
     ReflectorFallOff = reflectorFallOff;
     ReflectorRange = reflectorRange;
     ReflectorIntensity = reflectorIntensity;
     ReflectorConeDegrees = reflectorConeDegrees;
     LightType = lightType;
     PrefabLight = prefabLight;
     FlashOffset = flashOffset;
 }
Exemplo n.º 2
0
        /// <summary>
        /// CreatePrefab
        /// </summary>
        /// <param name="hudLabelText"></param>
        /// <param name="objBuilder"></param>
        /// <returns></returns>
        public MyPrefabBase CreatePrefab(string hudLabelText, MyPrefabContainer prefabContainer, MyMwcObjectBuilder_PrefabBase prefabBuilder)
        {
            Render.MyRender.GetRenderProfiler().StartProfilingBlock("MyPrefabFactory.CreatePrefab");

            MyPrefabConfiguration config = MyPrefabConstants.GetPrefabConfiguration(prefabBuilder.GetObjectBuilderType(), prefabBuilder.GetObjectBuilderId().Value);
            Vector3 relativePosition = MyPrefabContainer.GetRelativePositionInAbsoluteCoords(prefabBuilder.PositionInContainer);
            Matrix prefabLocalOrientation = Matrix.CreateFromYawPitchRoll(prefabBuilder.AnglesInContainer.X, prefabBuilder.AnglesInContainer.Y, prefabBuilder.AnglesInContainer.Z);

            MyPrefabBase prefab = null;
            if (config is MyPrefabConfigurationKinematic)
            {
                prefab = new MyPrefabKinematic(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLight)
            {
                prefab = new MyPrefabLight(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLargeWeapon)
            {
                prefab = new MyPrefabLargeWeapon(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationSound)
            {
                prefab = new MyPrefabSound(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationParticles)
            {
                prefab = new MyPrefabParticles(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationLargeShip)
            {
                prefab = new MyPrefabLargeShip(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationHangar)
            {
                prefab = new MyPrefabHangar(prefabContainer);                
            }
            else if(config is MyPrefabConfigurationFoundationFactory)
            {
                prefab = new MyPrefabFoundationFactory(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationSecurityControlHUB) 
            {
                prefab = new MyPrefabSecurityControlHUB(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationBankNode) 
            {
                prefab = new MyPrefabBankNode(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationGenerator) 
            {
                prefab = new MyPrefabGenerator(prefabContainer);                
            }
            else if (config is MyPrefabConfigurationScanner) 
            {
                prefab = new MyPrefabScanner(prefabContainer);
            }
            else if (config is MyPrefabConfigurationCamera)
            {
                prefab = new MyPrefabCamera(prefabContainer);
            }
            else if (config is MyPrefabConfigurationAlarm)
            {
                prefab = new MyPrefabAlarm(prefabContainer);
            }            
            else
            {
                prefab = new MyPrefab(prefabContainer);
                //prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);
            }
            prefab.Init(hudLabelText, relativePosition, prefabLocalOrientation, prefabBuilder, config);

            Render.MyRender.GetRenderProfiler().EndProfilingBlock();

            return prefab;
        }
        private void InitializeValues(MyPrefabLight prefabLight)
        {
            MyLight light = prefabLight.GetLight();

            m_pointNormalLightColorSlider[0].SetNormalizedValue(light.Color.X);
            m_pointNormalLightColorSlider[1].SetNormalizedValue(light.Color.Y);
            m_pointNormalLightColorSlider[2].SetNormalizedValue(light.Color.Z);
            m_specularLightColorSlider[0].SetNormalizedValue(light.SpecularColor.X);
            m_specularLightColorSlider[1].SetNormalizedValue(light.SpecularColor.Y);
            m_specularLightColorSlider[2].SetNormalizedValue(light.SpecularColor.Z);
            m_pointFallOffSlider.SetValue(light.Falloff);
            m_pointRangeSlider.SetValue(light.Range);
            m_pointIntensitySlider.SetValue(light.Intensity);
            m_pointOffsetSlider.SetValue(light.PointLightOffset);

            m_spotNormalLightColorSlider[0].SetNormalizedValue(light.ReflectorColor.X);
            m_spotNormalLightColorSlider[1].SetNormalizedValue(light.ReflectorColor.Y);
            m_spotNormalLightColorSlider[2].SetNormalizedValue(light.ReflectorColor.Z);
            m_spotFallOffSlider.SetValue(light.ReflectorFalloff);
            m_spotRangeSlider.SetValue(light.ReflectorRange);
            m_spotIntensitySlider.SetValue(light.ReflectorIntensity);
            m_spotAngleSlider.SetValue(light.ReflectorConeDegrees);

            m_pointLightCheckbox.Checked = (light.LightType & MyLight.LightTypeEnum.PointLight) != 0;
            m_hemisphereLightCheckbox.Checked = (light.LightType & MyLight.LightTypeEnum.Hemisphere) != 0;
            m_spotLightCheckbox.Checked = (light.LightType & MyLight.LightTypeEnum.Spotlight) != 0;
            m_spotLightShadowDistance.SetValue(light.ShadowDistance); 

            m_flashOffsetSlider.SetValue(prefabLight.FlashOffset);

            m_effectComboBox.SelectItemByIndex((int) prefabLight.Effect);

            SetComponentsVisibility();
        }