/// <summary> /// This method manages the spread of fire. /// </summary> /// <param name="gameTime">Used to add time between spreading fire.</param> private void Spread() { for (int i = 0; i < this.active.Count; i++) { FireSpread fire = (FireSpread)this.active[i]; for (int j = 0; j < 2; j++) { Vector3 temp = new Vector3(randy.Next(100) - 50, 0, randy.Next(100) - 50); temp.Normalize(); temp = Vector3.Add(fire.Position, temp * 2); fire.Fire.AddParticle(temp, Vector3.Zero); } } }
public void addSpread(Vector3 position, float flameSize) { FireSpread fire; //First check if there's an inactive object in the graveyard so it can be reused. if (this.graveyard.Count > 0) { fire = this.graveyard[0]; this.graveyard.RemoveAt(0); } else { fire = new FireSpread((Game1)game, false); } fire.Reset(new Vector3(position.X, position.Y, position.Z), flameSize * 0.6f); this.active.Add(fire); this.Game.Components.Add(fire); }