示例#1
0
        /// <summary>
        ///		Loads this stype from a given binary reader.
        /// </summary>
        /// <param name="reader">Binary reader to load this type from.</param>
        public void Load(BinaryReader reader)
        {
            _maximumCycles = reader.ReadInt32();
            _emitShape = (EmitShape)reader.ReadInt32();
            _particleLifeTimeRandom = new MinMax(reader.ReadInt32(), reader.ReadInt32());
            _emitCount = new MinMax(reader.ReadInt32(), reader.ReadInt32());
            _emitRate = new MinMax(reader.ReadInt32(), reader.ReadInt32());

            int modifierCount = reader.ReadInt32();

            // Load each modifier.
            for (int i = 0; i < modifierCount; i++)
            {
                string modName = reader.ReadString();
                ParticleModifier modifier = (ParticleModifier)ReflectionMethods.CreateObject(modName);
                modifier.ParticleType = this;
                modifier.Load(reader);
                _modifiers.Add(modifier);
            }
        }
示例#2
0
        /// <summary>
        ///		Loads this modifier from a given binary reader.
        /// </summary>
        /// <param name="reader">Binary reader to load this modifier from.</param>
        public override void Load(BinaryReader reader)
        {
            // Load ze base!
            base.Load(reader);

            // Load properties.
            int sr, sg, sb, sa;
            ColorMethods.SplitColor(ColorFormats.A8R8G8B8, reader.ReadInt32(), out sr, out sg, out sb, out sa);
            int fr, fg, fb, fa;
            ColorMethods.SplitColor(ColorFormats.A8R8G8B8, reader.ReadInt32(), out fr, out fg, out fb, out fa);

            _colorTint.Start = Color.FromArgb(sr, sg, sb);
            _colorTint.StartAlpha = (byte)sa;

            _colorTint.Finish = Color.FromArgb(fr, fg, fb);
            _colorTint.FinishAlpha = (byte)fa;

            _colorTintRedRandom = new MinMax(reader.ReadInt32(), reader.ReadInt32());
            _colorTintGreenRandom = new MinMax(reader.ReadInt32(), reader.ReadInt32());
            _colorTintBlueRandom = new MinMax(reader.ReadInt32(), reader.ReadInt32());
            _colorTintAlphaRandom = new MinMax(reader.ReadInt32(), reader.ReadInt32());
        }
示例#3
0
 /// <summary>
 ///     Invoked when a new instance of this class is created.
 /// </summary>
 /// <param name="emitRate">Minimum and maximum time period between emission cycles.</param>
 /// <param name="emitCount">Minimum and maximum amount of particles that are emitted each cycle.</param>
 /// <param name="emitShape">Shape in which particles are emitted.</param>
 /// <param name="maximumCycles">Maximum number of cycles this type can process.</param>
 /// <param name="particleLifeTimeRandom">Minimum and maximum randomization of life time.</param>
 public ParticleType(MinMax emitRate, MinMax emitCount, EmitShape emitShape, int maximumCycles, MinMax particleLifeTimeRandom)
 {
     _emitRate = emitRate;
     _emitCount = emitCount;
     _emitShape = emitShape;
     _maximumCycles = maximumCycles;
     _particleLifeTimeRandom = particleLifeTimeRandom;
     Restart();
 }