public static void GenerateTextureSequenceProperties(Particle.System.Def def, List <Particle.Texture> textures, PropertyTable props)
 {
     Particle.TextureSequence texSeq = def.m_TexSeq;
     props.AddProperty(new PropertySpec("Sprite ID 1", typeof(int), "Texture Sequence", "The 1st texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[0]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 2", typeof(int), "Texture Sequence", "The 2nd texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[1]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 3", typeof(int), "Texture Sequence", "The 3rd texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[2]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 4", typeof(int), "Texture Sequence", "The 4th texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[3]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 5", typeof(int), "Texture Sequence", "The 5th texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[4]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 6", typeof(int), "Texture Sequence", "The 6th texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[5]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 7", typeof(int), "Texture Sequence", "The 7th texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[6]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Sprite ID 8", typeof(int), "Texture Sequence", "The 8th texture's ID (-1 if not used)", textures.IndexOf(texSeq.m_Sprites[7]), "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(-1, highestTextureID) })); //TODO: Make limit depend on number of textures loaded
     props.AddProperty(new PropertySpec("Number of Sprites", typeof(int), "Texture Sequence", "How many sprites to actually use", texSeq.m_NumSprites, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 8) }));
     props.AddProperty(new PropertySpec("Interval", typeof(int), "Texture Sequence", "The time (x / 256) that each sprite should show up", texSeq.m_Interval, "", typeof(IntTypeConverter), new Attribute[] { new IntRangeAttribute(0, 255) }));
     props.AddProperty(new PropertySpec("Use As Options (Texture)", typeof(bool), "Texture Sequence", "Whether the values should be assigned randomly to particles instead of having a transition", texSeq.m_UseAsOptions, "", typeof(BoolTypeConverter)));
     props.AddProperty(new PropertySpec("Use Alternate Length (Texture)", typeof(bool), "Texture Sequence", "Whether to base the 'percents' off the alternate length instead of the lifetime", texSeq.m_UseAltLength, "", typeof(BoolTypeConverter)));
 }
Ejemplo n.º 2
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;
                    }
                }
            }
        }
Ejemplo n.º 3
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);
        }