/// <summary> /// Initializes a new instance of the <see cref="FireworkExplosion"/> class. /// </summary> /// <param name="parentFirework">The firework that has exploded (focus of an /// explosion).</param> /// <param name="stepNumber">The number of step this explosion took place at.</param> /// <param name="amplitude">The amplitude of an explosion.</param> /// <param name="sparkCounts">The collection that stores numbers of sparks generated /// during the explosion, per spark (firework) type.</param> /// <exception cref="System.ArgumentNullException"> if <paramref name="parentFirework"/> /// is <c>null</c>.</exception> /// <exception cref="System.ArgumentOutOfRangeException"> if <paramref name="amplitude"/> /// is <see cref="Double.NaN"/> or infinity.</exception> public FireworkExplosion(Firework parentFirework, int stepNumber, double amplitude, IDictionary <FireworkType, int> sparkCounts) : base(stepNumber, sparkCounts) { if (parentFirework == null) { throw new ArgumentNullException(nameof(parentFirework)); } if (double.IsNaN(amplitude) || double.IsInfinity(amplitude)) { throw new ArgumentOutOfRangeException(nameof(amplitude)); } this.ParentFirework = parentFirework; this.Amplitude = amplitude; }
/// <summary> /// Updates the firework by simply copying the fields. /// </summary> /// <param name="newState">New state of firework.</param> public void Update(Firework newState) { this.BirthStepNumber = newState.BirthStepNumber; this.Coordinates = newState.Coordinates; this.Quality = newState.Quality; }