예제 #1
0
        private void RebuildSettings()
        {
            // Make rebuild button red to help user not miss it after changes.
            GUIStyle style = new GUIStyle(GUI.skin.button);

            if (DoesStarSystemNeedRebuilding())
            {
                style.normal.textColor = Color.red;
            }

            // Rebuild our data images if necessary.
            if (GUILayout.Button("Rebuild Star System", style))
            {
                if (_builder == null)
                {
                    _builder = CreateSkyBuilder();
                }

                if (_builder.IsComplete == false)
                {
                    return;
                }

                _builder.BuildSkySystem();
            }
        }
예제 #2
0
        private SkyBuilder CreateSkyBuilder()
        {
            SkyBuilder b = new SkyBuilder();

            b.starLayer1Enabled   = _starLayer1Enabled;
            b.starLayer2Enabled   = _starLayer2Enabled;
            b.starLayer3Enabled   = _starLayer3Enabled;
            b.skyboxMaterial      = _skyboxMaterial;
            b.completionCallback += BuilderCompletion;

            return(b);
        }
예제 #3
0
        private void BuilderCompletion(SkyBuilder builder, bool successful)
        {
            m_Builder.completionCallback -= BuilderCompletion;
            m_Builder = null;

            if (m_Profile)
            {
                EditorUtility.SetDirty(m_Profile);
            }

            TimeOfDayController tc = GameObject.FindObjectOfType <TimeOfDayController>();

            if (tc != null)
            {
                tc.UpdateSkyForCurrentTime();
            }
        }
예제 #4
0
        private void RebuildSkySystem()
        {
            if (m_Builder != null)
            {
                m_Builder.CancelBuild();
                m_Builder = null;
            }

            m_Builder = CreateSkyBuilder();

            if (m_Builder.IsComplete == false)
            {
                return;
            }

            m_Builder.BuildSkySystem();
        }
예제 #5
0
        private SkyBuilder CreateSkyBuilder()
        {
            SkyBuilder b = new SkyBuilder();

            b.profile           = m_Profile;
            b.starLayer1Enabled = m_Profile.IsFeatureEnabled(ProfileFeatureKeys.StarLayer1Feature);
            b.starLayer2Enabled = m_Profile.IsFeatureEnabled(ProfileFeatureKeys.StarLayer2Feature);;
            b.starLayer3Enabled = m_Profile.IsFeatureEnabled(ProfileFeatureKeys.StarLayer3Feature);;

            b.starLayer1Density = m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star1DensityKey).GetFirstValue();
            b.starLayer2Density = m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star2DensityKey).GetFirstValue();
            b.starLayer3Density = m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star3DensityKey).GetFirstValue();

            b.starLayer1MaxRadius = GetMaxValueForGroup(m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star1SizeKey));
            b.starLayer2MaxRadius = GetMaxValueForGroup(m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star2SizeKey));
            b.starLayer3MaxRadius = GetMaxValueForGroup(m_Profile.GetGroup <NumberKeyframeGroup>(ProfilePropertyKeys.Star3SizeKey));

            b.skyboxMaterial      = m_Profile.skyboxMaterial;
            b.completionCallback += BuilderCompletion;

            return(b);
        }
예제 #6
0
 private void BuilderCompletion(SkyBuilder builder, bool successful)
 {
     _builder.completionCallback -= BuilderCompletion;
     _builder            = null;
     _skyNeedsRebuilding = false;
 }