Пример #1
0
        void Start()
        {
            if (!HighLogic.LoadedSceneIsFlight)
            {
                return;
            }

            engine = new FSengineWrapper(part);

            // Create the mesh disc. Particles spawn inside this mesh on the ground
            washDisc.transform.parent = transform;
            meshFilter      = washDisc.AddComponent <MeshFilter>();
            meshFilter.mesh = MeshCreator.createDisc(emissionDiscSize, 100);

            // fetch the particle texture from KSP's Game Database
            particleTexture = GameDatabase.Instance.GetTexture(particleTextureName, false);

            if (particleTexture == null)
            {
                Debug.Log("FSgroundParticles: particle texture loading error");
                // it should use the default particle in this case, or just some pink crap maybe
            }
            else
            {
                //Setting the values for the particle system. the animator is never doing anything exciting, all particle motion is handled in the late update code
                particleFX = new FSparticleFX(washDisc, particleTexture);

                // particles change color and alpha over time.
                particleFX.AnimatorColor0 = getColorFromV4(particleColor0);
                particleFX.AnimatorColor1 = getColorFromV4(particleColor1);
                particleFX.AnimatorColor2 = getColorFromV4(particleColor2);
                particleFX.AnimatorColor3 = getColorFromV4(particleColor3);
                particleFX.AnimatorColor4 = getColorFromV4(particleColor4);

                particleFX.EmitterMinSize     = particleSize.x;
                particleFX.EmitterMaxSize     = particleSize.y;
                particleFX.EmitterMinEnergy   = particleEnergy.x;
                particleFX.EmitterMaxEnergy   = particleEnergy.y;
                particleFX.EmitterMinEmission = 0f;
                particleFX.EmitterMaxEmission = 0f;
                particleFX.AnimatorSizeGrow   = particleSizeGrow;

                particleFX.EmitterLocalVelocity = new Vector3(0f, 0f, 0f);
                particleFX.EmitterRndVelocity   = new Vector3(0f, 0f, 0f);
                // creates the emitters etc and assigns the above values
                particleFX.setupFXValues();

                //particleFX.pEmitter.rndRotation = true;

                // Can't turn on Interpolate Triangles on the emitter, casue it's not exposed to code. REALLY?!? WHY?
            }

            thrustTransform = part.FindModelTransform(thrustTransformName);
        }
Пример #2
0
        void Start()
        {
            if (!HighLogic.LoadedSceneIsFlight) return;

            engine = new FSengineWrapper(part);

            // Create the mesh disc. Particles spawn inside this mesh on the ground
            washDisc.transform.parent = transform;
            meshFilter = washDisc.AddComponent<MeshFilter>();            
            meshFilter.mesh = MeshCreator.createDisc(emissionDiscSize, 100);

            // fetch the particle texture from KSP's Game Database
            particleTexture = GameDatabase.Instance.GetTexture(particleTextureName, false);            
                                      
            if (particleTexture == null)
            {
                Debug.Log("FSgroundParticles: particle texture loading error");
                // it should use the default particle in this case, or just some pink crap maybe
            }
            else
            {
                //Setting the values for the particle system. the animator is never doing anything exciting, all particle motion is handled in the late update code
                particleFX = new FSparticleFX(washDisc, particleTexture);  
           
                // particles change color and alpha over time.
                particleFX.AnimatorColor0 = getColorFromV4(particleColor0);
                particleFX.AnimatorColor1 = getColorFromV4(particleColor1);
                particleFX.AnimatorColor2 = getColorFromV4(particleColor2);
                particleFX.AnimatorColor3 = getColorFromV4(particleColor3);
                particleFX.AnimatorColor4 = getColorFromV4(particleColor4);                

                particleFX.EmitterMinSize = particleSize.x;
                particleFX.EmitterMaxSize = particleSize.y;
                particleFX.EmitterMinEnergy = particleEnergy.x;
                particleFX.EmitterMaxEnergy = particleEnergy.y;
                particleFX.EmitterMinEmission = 0f;
                particleFX.EmitterMaxEmission = 0f;
                particleFX.AnimatorSizeGrow = particleSizeGrow;

                particleFX.EmitterLocalVelocity = new Vector3(0f, 0f, 0f);
                particleFX.EmitterRndVelocity = new Vector3(0f, 0f, 0f);                
                // creates the emitters etc and assigns the above values
                particleFX.setupFXValues();

                //particleFX.pEmitter.rndRotation = true;

                // Can't turn on Interpolate Triangles on the emitter, casue it's not exposed to code. REALLY?!? WHY?
            }

            thrustTransform = part.FindModelTransform(thrustTransformName);
        }