/// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 /// <param name="col">Color of the particles in the system</param>
 public PSFirework(Vector pos, Color col)
 {
     // Set system's position at given position
     m_Position = pos;
     // Set system color to given color
     m_Color = col;
     // Initialize the system
     InitSystem();
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Position <see cref="Vector"/> of newly created particle</param>
 /// <param name="velocity">Velocity <see cref="Vector"/> of newly created particle</param>
 /// <param name="col">Color of newly created particle</param>
 /// <param name="life">Starting age of newly created particle</param>
 public Particle(Vector pos, Vector velocity, Color col, int life)
 {
     // Create particle at given position
     m_Position = pos;
     // Set particle's speed to given speed
     m_Velocity = velocity;
     // Set particle's color to given color
     m_Color = col;
     // Make sure starting age is valid
     if (life > 0)
         m_Life = life;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 /// <param name="col">Color of the particles in the system</param>
 public PSExplosion(Vector pos, Color col)
 {
     // Set system's position at given position
     m_Position = pos;
     // Set system color to given color
     m_Color = col;
     // Create all the particles in the system
     for (int i = 0; i < DEFAULT_NUM_PARTICLES; i++)
     {
         // Create particle, and add it to the list of particles
         m_Particles.Add(GenerateParticle());
     }
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 /// <param name="col">Color of the particles in the system</param>
 public PSFountain(Vector pos, Color col)
 {
     // Mark that this system regenerates particles
     m_Regenerate = true;
     // Set system's position at given position
     m_Position = pos;
     // Set system color to given color
     m_Color = col;
     // Create ONLY 5 particles
     for (int i = 0; i < 5; i++)
     {
         // Create particle, and add it to the list of particles
         m_Particles.Add(GenerateParticle());
     }
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 public PSExplosion(Vector pos)
     : this(Vector.Zero, Color.Black)
 {
 }
 /// <summary>
 /// Initiate vector with same values as given Vector
 /// </summary>
 /// <param name="v">Vector to copy coordinations</param>
 public Vector(Vector vector)
 {
     m_Xcoord = vector.X;
     m_Ycoord = vector.Y;
     m_Zcoord = vector.Z;
 }
 /// <summary>
 /// Substract 2 vectors and create a new one.
 /// </summary>
 /// <param name="vector1">First vector</param>
 /// <param name="vector2">Second vector</param>
 /// <returns>New vector that is the difference of the 2 vectors</returns>
 public static Vector Subtract(Vector vector1, Vector vector2)
 {
     if (((Object)vector1 == null) || ((Object)vector2 ==null))
         return null;
     return new Vector(vector1.X - vector2.X, vector1.Y - vector2.Y, vector1.Z - vector2.Z);
 }
 /// <summary>
 /// Return a new vector with negative values.
 /// </summary>
 /// <param name="v">Original vector</param>
 /// <returns>New vector that is the inversion of the original vector</returns>
 public static Vector Neg(Vector vector)
 {
     if ((Object)vector == null)
         return null;
     return new Vector(-vector.X, -vector.Y, -vector.Z);
 }
 /// <summary>
 /// Multiply a vector with a scalar
 /// </summary>
 /// <param name="vector">Vector to be multiplied</param>
 /// <param name="val">Scalar to multiply vector</param>
 /// <returns>New vector that is the multiplication of the vector with the scalar</returns>
 public static Vector Multiply(Vector vector, float val)
 {
     if ((Object)vector == null)
         return null;
     return new Vector(vector.X * val, vector.Y * val, vector.Z * val);
 }
 /// <summary>
 /// Add 2 vectors and create a new one.
 /// </summary>
 /// <param name="vector1">First vector</param>
 /// <param name="vector2">Second vector</param>
 /// <returns>New vector that is the sum of the 2 vectors</returns>
 public static Vector Add(Vector vector1, Vector vector2)
 {
     if (((Object)vector1 == null) || ((Object)vector2 ==null))
         return null;
     return new Vector(vector1.X + vector2.X, vector1.Y + vector2.Y, vector1.Z + vector2.Z);
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 public PSFountain(Vector pos)
     : this(pos, Color.Black)
 {
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Central position of the system</param>
 public ParticlesSystem(Vector pos)
 {
     // Set system's position to given position
     m_Position = pos;
 }
 /// <summary>
 /// Default constructor
 /// </summary>
 public ParticlesSystem()
 {
     // Set default position of the system
     m_Position = Vector.Zero;
 }
 /// <summary>
 /// Update position, velocity and age of particle
 /// </summary>
 /// <returns>False - if particle is too old and should be killed
 /// True - otherwise</returns>
 public virtual void Update()
 {
     // Update particle's movement according to environment
     m_Velocity = m_Velocity - Environment.GetInstance().Gravity
                             + Environment.GetInstance().Wind;
     // Update particle's position according to movement
     m_Position = m_Position + m_Velocity;
     // Update particle's age
     m_Life++;
 }
 /// <summary>
 /// Constructor
 /// </summary>
 /// <param name="pos">Starting position of system</param>
 public PSFirework(Vector pos)
     : this(pos, Color.Black)
 {
 }