public SgtStarfieldCustom MakeEditableCopy(int layer, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale)
        {
#if UNITY_EDITOR
            SgtHelper.BeginUndo("Create Editable Starfield Copy");
#endif
            var gameObject      = SgtHelper.CreateGameObject("Editable Starfield Copy", layer, parent, localPosition, localRotation, localScale);
            var customStarfield = SgtHelper.AddComponent <SgtStarfieldCustom>(gameObject, false);
            var quads           = new List <SgtStarfieldStar>();
            var starCount       = BeginQuads();

            for (var i = 0; i < starCount; i++)
            {
                var quad = SgtPoolClass <SgtStarfieldStar> .Pop() ?? new SgtStarfieldStar();

                NextQuad(ref quad, i);

                quads.Add(quad);
            }

            EndQuads();

            // Copy common settings
            customStarfield.Color         = Color;
            customStarfield.Brightness    = Brightness;
            customStarfield.MainTex       = MainTex;
            customStarfield.Layout        = Layout;
            customStarfield.LayoutColumns = LayoutColumns;
            customStarfield.LayoutRows    = LayoutRows;
            customStarfield.LayoutRects   = new List <Rect>(LayoutRects);
            customStarfield.BlendMode     = BlendMode;
            customStarfield.RenderQueue   = RenderQueue;
            customStarfield.PowerRgb      = PowerRgb;
            customStarfield.ClampSize     = ClampSize;
            customStarfield.ClampSizeMin  = ClampSizeMin;
            customStarfield.Stretch       = Stretch;
            customStarfield.StretchVector = StretchVector;
            customStarfield.StretchScale  = StretchScale;
            customStarfield.StretchLimit  = StretchLimit;
            customStarfield.Near          = Near;
            customStarfield.NearTex       = NearTex;
            customStarfield.NearThickness = NearThickness;
            customStarfield.Pulse         = Pulse;
            customStarfield.PulseOffset   = PulseOffset;
            customStarfield.PulseSpeed    = PulseSpeed;

            // Copy custom settings
            customStarfield.Stars = quads;

            // Update
            customStarfield.UpdateMaterial();
            customStarfield.UpdateMeshesAndModels();

            return(customStarfield);
        }
Exemplo n.º 2
0
        public SgtBeltCustom MakeEditableCopy(int layer, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale)
        {
#if UNITY_EDITOR
            SgtHelper.BeginUndo("Create Editable Belt Copy");
#endif
            var gameObject = SgtHelper.CreateGameObject("Editable Belt Copy", layer, parent, localPosition, localRotation, localScale);
            var customBelt = SgtHelper.AddComponent <SgtBeltCustom>(gameObject, false);
            var quads      = new List <SgtBeltAsteroid>();
            var quadCount  = BeginQuads();

            for (var i = 0; i < quadCount; i++)
            {
                var asteroid = SgtPoolClass <SgtBeltAsteroid> .Pop() ?? new SgtBeltAsteroid();

                NextQuad(ref asteroid, i);

                quads.Add(asteroid);
            }

            EndQuads();

            // Copy common settings
            customBelt.Color         = Color;
            customBelt.Brightness    = Brightness;
            customBelt.MainTex       = MainTex;
            customBelt.Layout        = Layout;
            customBelt.LayoutColumns = LayoutColumns;
            customBelt.LayoutRows    = LayoutRows;
            customBelt.LayoutRects   = new List <Rect>(LayoutRects);
            customBelt.BlendMode     = BlendMode;
            customBelt.RenderQueue   = RenderQueue;
            customBelt.OrbitOffset   = OrbitOffset;
            customBelt.OrbitSpeed    = OrbitSpeed;
            customBelt.Lit           = Lit;
            customBelt.LightingTex   = LightingTex;
            customBelt.AmbientColor  = AmbientColor;
            customBelt.PowerRgb      = PowerRgb;

            // Copy custom settings
            customBelt.Asteroids = quads;

            // Update
            customBelt.UpdateMaterial();
            customBelt.UpdateMeshesAndModels();

            return(customBelt);
        }
Exemplo n.º 3
0
        public SgtStarfieldCustom MakeEditableCopy(int layer, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale)
        {
#if UNITY_EDITOR
            SgtHelper.BeginUndo("Create Editable Starfield Copy");
#endif
            var gameObject      = SgtHelper.CreateGameObject("Editable Starfield Copy", layer, parent, localPosition, localRotation, localScale);
            var customStarfield = SgtHelper.AddComponent <SgtStarfieldCustom>(gameObject, false);
            var stars           = customStarfield.Stars;
            var starCount       = BeginQuads();

            for (var i = 0; i < starCount; i++)
            {
                var star = SgtPoolClass <SgtStarfieldStar> .Pop() ?? new SgtStarfieldStar();

                NextQuad(ref star, i);

                stars.Add(star);
            }

            EndQuads();

            // Copy common settings
            customStarfield.Color         = color;
            customStarfield.Brightness    = brightness;
            customStarfield.MainTex       = mainTex;
            customStarfield.Layout        = layout;
            customStarfield.LayoutColumns = layoutColumns;
            customStarfield.LayoutRows    = layoutRows;
            customStarfield.layoutRects   = new List <Rect>(layoutRects);
            customStarfield.blendMode     = blendMode;
            customStarfield.renderQueue   = renderQueue;
            customStarfield.powerRgb      = powerRgb;
            customStarfield.clampSize     = clampSize;
            customStarfield.clampSizeMin  = clampSizeMin;
            customStarfield.stretch       = stretch;
            customStarfield.stretchVector = stretchVector;
            customStarfield.stretchScale  = stretchScale;
            customStarfield.stretchLimit  = stretchLimit;
            customStarfield.near          = near;
            customStarfield.nearTex       = nearTex;
            customStarfield.nearThickness = nearThickness;
            customStarfield.pulse         = pulse;
            customStarfield.pulseOffset   = pulseOffset;
            customStarfield.pulseSpeed    = pulseSpeed;

            return(customStarfield);
        }
Exemplo n.º 4
0
        public SgtBeltCustom MakeEditableCopy(int layer, Transform parent, Vector3 localPosition, Quaternion localRotation, Vector3 localScale)
        {
#if UNITY_EDITOR
            SgtHelper.BeginUndo("Create Editable Belt Copy");
#endif
            var gameObject = SgtHelper.CreateGameObject("Editable Belt Copy", layer, parent, localPosition, localRotation, localScale);
            var customBelt = SgtHelper.AddComponent <SgtBeltCustom>(gameObject, false);
            var asteroids  = customBelt.Asteroids;
            var quadCount  = BeginQuads();

            for (var i = 0; i < quadCount; i++)
            {
                var asteroid = SgtPoolClass <SgtBeltAsteroid> .Pop() ?? new SgtBeltAsteroid();

                NextQuad(ref asteroid, i);

                asteroids.Add(asteroid);
            }

            EndQuads();

            // Copy common settings
            customBelt.Color         = Color;
            customBelt.Brightness    = Brightness;
            customBelt.mainTex       = mainTex;
            customBelt.layout        = layout;
            customBelt.layoutColumns = layoutColumns;
            customBelt.layoutRows    = layoutRows;
            customBelt.layoutRects   = new List <Rect>(layoutRects);
            customBelt.blendMode     = blendMode;
            customBelt.renderQueue   = renderQueue;
            customBelt.orbitOffset   = orbitOffset;
            customBelt.orbitSpeed    = orbitSpeed;
            customBelt.lit           = lit;
            customBelt.lightingTex   = lightingTex;
            customBelt.ambientColor  = ambientColor;
            customBelt.powerRgb      = powerRgb;

            return(customBelt);
        }