/// <summary>
        /// Initializes a new instance of the <see cref="EmitterTreeNode"/> class.
        /// </summary>
        /// <param name="emitter">The emitter.</param>
        public EmitterTreeNode(Emitter emitter) : base()
        {
            Guard.ArgumentNull("emitter", emitter);

            this.Emitter = emitter;

            this.ForeColor = emitter.Enabled ? SystemColors.WindowText : Color.Gray;

            this.Text = emitter.Enabled ? emitter.Name : String.Format("{0} (Disabled)", emitter.Name);

            this.Emitter.NameChanged += (o, s) => this.Text = this.Emitter.Name;

            this.Tag = emitter;

            foreach (Modifier modifier in emitter.Modifiers)
            {
                ModifierTreeNode node = new ModifierTreeNode(modifier);

                this.Nodes.Add(node);
            }

            if (emitter.Enabled)
            {
                this.Expand();
            }
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmitterReinitialisedEventArgs"/> class.
 /// </summary>
 /// <param name="emitter">The emitter.</param>
 /// <param name="budget">The new budget value.</param>
 /// <param name="term">The new term value.</param>
 public EmitterReinitialisedEventArgs(Emitter emitter, int budget, float term)
     : base()
 {
     this.Emitter = emitter;
     this.Budget = budget;
     this.Term = term;
 }
示例#3
0
 static public void Serialize(Emitter emitter, string filePath)
 {
     using (XmlWriter writer = XmlWriter.Create(filePath, new XmlWriterSettings
         {
             Indent          = true,
             NewLineHandling = NewLineHandling.Entitize
         }))
     {
         IntermediateSerializer.Serialize<Emitter>(writer, emitter, ".\\");
     }
 }
示例#4
0
        /// <summary>
        /// Draws an emitter.
        /// </summary>
        /// <param name="totalTime">Total game time in whole and fractional seconds.</param>
        /// <param name="emitter">The emitter to be drawn.</param>
        internal void Draw(float totalTime, Emitter<Particle> emitter)
        {
            this.Prepare(totalTime, emitter);

            for (int i = 0; i < emitter.ActiveParticlesCount; i++)
            {
                IParticle particle = emitter.Get(i);

                this.RenderParticle(totalTime, particle);
            }

            this.PostRender(totalTime);
        }
示例#5
0
 /// <summary>
 /// Begins rendering of an emitter, called before any particles are drawn.
 /// </summary>
 /// <param name="totalTime">Total game time in whole and fractional seconds.</param>
 /// <param name="emitter">The emitter which is about to be rendered.</param>
 protected virtual void Prepare(float totalTime, Emitter<Particle> emitter) { }
        /// <summary>
        /// Prepares the renderer for rendering.
        /// </summary>
        /// <param name="totalTime">Total game time in whole and fractional seconds.</param>
        /// <param name="emitter">The emitter which is about to be rendered.</param>
        protected override void Prepare(float totalTime, Emitter emitter)
        {
            this._drawIndex = 0;

            Texture2D texture = (emitter.ParticleTexture != null ? emitter.ParticleTexture : base.DefaultTexture);

            this._textureParam.SetValue(texture);
        }
 public MercuryLineParticleEffect(Renderer renderer, Emitter emitter)
 {
     _renderer = renderer;
     _emitter = (LineEmitter)emitter;
 }
示例#8
0
 /// <summary>
 /// Copies the fields of the Emitter base class into the specified Emitter.
 /// </summary>
 /// <param name="emitter">The Emitter which will be copied into.</param>
 protected void CopyBaseFields(Emitter emitter)
 {
     emitter.BlendMode                = this.BlendMode;
     emitter.Budget                   = this.Budget;
     emitter.Enabled                  = this.Enabled;
     emitter.MinimumTriggerPeriod     = this.MinimumTriggerPeriod;
     emitter.Modifiers                = this.Modifiers.DeepCopy();
     emitter.Name                     = String.Format("Copy of {0}", this.Name);
     emitter.ParticleTexture          = this.ParticleTexture;
     emitter.ParticleTextureAssetName = String.Copy(this.ParticleTextureAssetName ?? String.Empty);
     emitter.ReleaseColour            = this.ReleaseColour;
     emitter.ReleaseOpacity           = this.ReleaseOpacity;
     emitter.ReleaseQuantity          = this.ReleaseQuantity;
     emitter.ReleaseRotation          = this.ReleaseRotation;
     emitter.ReleaseScale             = this.ReleaseScale;
     emitter.ReleaseSpeed             = this.ReleaseSpeed;
     emitter.ReleaseImpulse           = this.ReleaseImpulse;
     emitter.Term                     = this.Term;
     emitter.TriggerOffset            = this.TriggerOffset;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="TextureReferenceChangedEventArgs"/> class.
 /// </summary>
 /// <param name="emitter">The emitter.</param>
 /// <param name="textureReference">The texture reference.</param>
 public TextureReferenceChangedEventArgs(Emitter emitter, TextureReference textureReference)
     : base(emitter)
 {
     this.TextureReference = textureReference;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="NewModifierEventArgs"/> class.
 /// </summary>
 /// <param name="parentEmitter">The parent emitter.</param>
 /// <param name="plugin">The plugin.</param>
 public NewModifierEventArgs(Emitter parentEmitter, IModifierPlugin plugin)
     : base()
 {
     this.ParentEmitter = parentEmitter;
     this.Plugin = plugin;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="EmitterEventArgs"/> class.
 /// </summary>
 /// <param name="emitter">The emitter.</param>
 public EmitterEventArgs(Emitter emitter) : base()
 {
     this.Emitter = emitter;
 }
 /// <summary>
 /// Initializes a new instance of the <see cref="CloneEmitterEventArgs"/> class.
 /// </summary>
 /// <param name="prototype">The prototype.</param>
 public CloneEmitterEventArgs(Emitter prototype)
     : base()
 {
     this.Prototype = prototype;
 }
示例#13
0
文件: Editor.cs 项目: zakvdm/Frenetic
        private void CreateEmitter(string type, int budget, float term)
        {
            var oldColour = this.Emitter.ReleaseColour;
            var oldOpacity = this.Emitter.ReleaseOpacity;
            var oldQuantity = this.Emitter.ReleaseQuantity;
            var oldRotation = this.Emitter.ReleaseRotation;
            var oldScale = this.Emitter.ReleaseScale;
            var oldSpeed = this.Emitter.ReleaseSpeed;
            var oldModifier = this.Emitter.Modifiers;

            switch (type)
            {
                case "Emitter":
                    {
                        this.Emitter = new Emitter();

                        break;
                    }
                case "CircleEmitter":
                    {
                        this.Emitter = new CircleEmitter
                        {
                            Radius = 50f,
                            Ring = false,
                            Radiate = true
                        };

                        break;
                    }
                case "ConeEmitter":
                    {
                        this.Emitter = new ConeEmitter
                        {
                            Direction = 0f,
                            ConeAngle = MathHelper.ToRadians(40f)
                        };

                        break;
                    }
                case "LineEmitter":
                    {
                        this.Emitter = new LineEmitter
                        {
                            Length = 100
                        };

                        break;
                    }
                case "PolygonEmitter":
                    {
                        this.Emitter = new PolygonEmitter
                        {
                            Points = new PolygonPointCollection
                            {
                                new Vector2 { X = -100f, Y =  100f },
                                new Vector2 { X =  0f,   Y = -100f },
                                new Vector2 { X =  100f, Y =  100f }
                            }
                        };

                        break;
                    }
                case "RectEmitter":
                    {
                        this.Emitter = new RectEmitter
                        {
                            Width = 100,
                            Height = 100
                        };

                        break;
                    }
            }

            this.Emitter.Budget = budget;
            this.Emitter.ParticleTexture = this.ParticleTexture;
            this.Emitter.ReleaseColour = oldColour;
            this.Emitter.ReleaseOpacity = oldOpacity;
            this.Emitter.ReleaseQuantity = oldQuantity;
            this.Emitter.ReleaseRotation = oldRotation;
            this.Emitter.ReleaseScale = oldScale;
            this.Emitter.ReleaseSpeed = oldSpeed;
            this.Emitter.Modifiers = oldModifier;
            this.Emitter.Term = term;

            this.Emitter.Initialize();

            this.ControlPanel.EmitterPropertyGridWrapper = this.Emitter;
        }
示例#14
0
文件: Editor.cs 项目: zakvdm/Frenetic
        private void LoadEmitter(string filePath)
        {
            this.Emitter = EmitterSerializer.Deserialize(filePath);

            this.Emitter.Initialize();

            this.Emitter.ParticleTexture = this.ParticleTexture;

            this.ControlPanel.EmitterPropertyGridWrapper = this.Emitter;
        }
示例#15
0
 /// <summary>
 /// Begins rendering of an emitter, called before any particles are drawn.
 /// </summary>
 /// <param name="totalTime">Total game time in whole and fractional seconds.</param>
 /// <param name="emitter">The emitter which is about to be rendered.</param>
 protected virtual void Prepare(float totalTime, Emitter emitter) { }
示例#16
0
        /// <summary>
        /// Returns an unitialised deep copy of the Emitter.
        /// </summary>
        /// <returns>A deep copy of the Emitter.</returns>
        public virtual Emitter DeepCopy()
        {
            Emitter emitter = new Emitter();

            this.CopyBaseFields(emitter);

            return emitter;
        }
 public MercuryPointParticleEffect(Renderer renderer, Emitter trailEmitter, Emitter explosionEmitter)
 {
     this.Renderer = renderer;
     this.TrailEmitter = trailEmitter;
     this.ExplosionEmitter = explosionEmitter;
 }