Exemplo n.º 1
0
        private void UpdateParticleTextures(int textureId)
        {
            // m_SpriteID contains the previous id, update all of the textures that are still using it
            Particle.Texture newTexture = m_TexDefs[textureId];

            for (int i = 0; i < m_SysDefs.Count; i++)
            {
                Particle.System.Def sysDef = m_SysDefs[i];

                // main texture
                Particle.MainInfo info = sysDef.m_MainInfo;
                if (info.m_Sprite.m_SpriteID == textureId)
                {
                    info.m_Sprite = newTexture;
                }

                // texseq textures
                if (sysDef.m_TexSeq != null)
                {
                    Particle.TextureSequence texSeq = sysDef.m_TexSeq;
                    for (int j = 0; j < texSeq.m_Sprites.Length; j++)
                    {
                        if (texSeq.m_Sprites[j] != null && texSeq.m_Sprites[j].m_SpriteID == textureId)
                        {
                            texSeq.m_Sprites[j] = newTexture;
                        }
                    }
                }

                // glitter texture
                if (sysDef.m_Glitter != null)
                {
                    Particle.Glitter glitter = sysDef.m_Glitter;
                    if (glitter.m_Sprite.m_SpriteID == textureId)
                    {
                        glitter.m_Sprite = newTexture;
                    }
                }
            }
        }
Exemplo n.º 2
0
        bool CanTextureBeRemoved(int textureId)
        {
            for (int i = 0; i < m_SysDefs.Count; i++)
            {
                Particle.System.Def sysDef = m_SysDefs[i];

                // main texture
                Particle.MainInfo info = sysDef.m_MainInfo;
                if (m_TexDefs.IndexOf(info.m_Sprite) == textureId)
                {
                    return(false);
                }

                // texseq textures
                if (sysDef.m_TexSeq != null)
                {
                    Particle.TextureSequence texSeq = sysDef.m_TexSeq;
                    for (int j = 0; j < texSeq.m_Sprites.Length; j++)
                    {
                        if (texSeq.m_Sprites[j] != null && m_TexDefs.IndexOf(texSeq.m_Sprites[j]) == textureId)
                        {
                            return(false);
                        }
                    }
                }

                // glitter texture
                if (sysDef.m_Glitter != null)
                {
                    Particle.Glitter glitter = sysDef.m_Glitter;
                    if (m_TexDefs.IndexOf(glitter.m_Sprite) == textureId)
                    {
                        return(false);
                    }
                }
            }

            return(true);
        }
 public static void GenerateGlitterProperties(Particle.System.Def def, List <Particle.Texture> textures, PropertyTable props)
 {
     Particle.Glitter glitter = def.m_Glitter;
     props.AddProperty(new PropertySpec("Has Effects", typeof(bool), "Glitter", "Whether the glitter particles use the same effects", glitter.m_HasEffects, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Has Scale Transition (Glitter)", typeof(bool), "Glitter", "Whether to transition the scale multiplier to 1.0", glitter.m_HasScaleTrans, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Has Alpha Transition (Glitter)", typeof(bool), "Glitter", "Whether to fade glitter particles away", glitter.m_HasAlphaTrans, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Angle Copy Mode", typeof(int), "Glitter", "What angle properties glitter particles should copy from their parent particles", (int)glitter.m_AngleCopyMode, "", typeof(ItemListTypeConverter), new Attribute[] { new ItemListAttribute(new string[] { "None", "Angle", "Angle and Angular Speed" }.ToList()) }));
     props.AddProperty(new PropertySpec("Follow System (Glitter)", typeof(bool), "Glitter", "Whether glitter particles should follow their parent system when it moves", glitter.m_FollowSystem, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Use Glitter Color", typeof(bool), "Glitter", "Whether glitter particles use the glitter color instead of the main color", glitter.m_UseGlitterColor, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Draw Mode (Glitter)", typeof(int), "Glitter", "How glitter particles are drawn on screen", (int)glitter.m_DrawMode, "", typeof(ItemListTypeConverter), new Attribute[] { new ItemListAttribute(new string[] { "Billboard", "Velocity Stretch", "3D" }.ToList()) }));
     props.AddProperty(new PropertySpec("Speed Randomness (Glitter)", typeof(float), "Glitter", "The maximum difference in velocity between a glitter particle and its parent", glitter.m_SpeedRand, "", typeof(FloatTypeConverter), new Attribute[] { new FloatRangeAttribute(-64, 64, FloatRangeAttribute.Inclusivity.INCLUDE_FIRST) }));
     props.AddProperty(new PropertySpec("Scale (Glitter)", typeof(float), "Glitter", "The initial scale if glitter particles have a scale transition", glitter.m_Scale, "", typeof(FloatTypeConverter), new Attribute[] { new FloatRangeAttribute(-0x80000, 0x80000, FloatRangeAttribute.Inclusivity.INCLUDE_FIRST) }));
     props.AddProperty(new PropertySpec("Lifetime (Glitter)", typeof(int), "Glitter", "The number of frames glitter particles exist for", glitter.m_Lifetime, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 0xffff) }));
     props.AddProperty(new PropertySpec("Speed Multiplier", typeof(int), "Glitter", "How fast glitter particles go compared to their parent particles (x / 256)", glitter.m_SpeedMult, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 0xff) }));
     props.AddProperty(new PropertySpec("Scale Multiplier", typeof(int), "Glitter", "How big glitter particles are compared to their parent particles assuming no scale transition ((x + 1) / 64)", glitter.m_ScaleMult, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 0xff) }));
     props.AddProperty(new PropertySpec("Color (Glitter)", typeof(Color), "Glitter", "The glitter color of the particles", glitter.m_Color, typeof(ColorTypeEditor), typeof(ColorTypeConverter)));
     props.AddProperty(new PropertySpec("Rate (Glitter)", typeof(int), "Glitter", "The number of glitter particles each particle spawns per frame spawning particles (integer)", glitter.m_Rate, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 0xff) }));
     props.AddProperty(new PropertySpec("Wait", typeof(int), "Glitter", "The fraction of a particle's lifetime that should pass before it spawns glitter ((x + 1) / 256)", glitter.m_Wait, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 0xff) }));
     props.AddProperty(new PropertySpec("Period (Glitter)", typeof(int), "Glitter", "One more than the number of frames between glitter particle spawnings.", glitter.m_Period, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(1, 0xff) }));
     props.AddProperty(new PropertySpec("Sprite ID (Glitter)", typeof(int), "Glitter", "The ID of the texture to use", textures.IndexOf(glitter.m_Sprite), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Texture Repeat X (Glitter)", typeof(int), "Glitter", "How much to repeat the texture in the X direction", glitter.m_LogTexRepeatHorz, "", typeof(ItemListTypeConverter), new Attribute[] { new ItemListAttribute(new string[] { "1", "2", "4", "8" }.ToList()) }));
     props.AddProperty(new PropertySpec("Texture Repeat Y (Glitter)", typeof(int), "Glitter", "How much to repeat the texture in the Y direction", glitter.m_LogTexRepeatVert, "", typeof(ItemListTypeConverter), new Attribute[] { new ItemListAttribute(new string[] { "1", "2", "4", "8" }.ToList()) }));
 }