#region File Description //----------------------------------------------------------------------------- // RocketWeapon.cs // // Microsoft XNA Community Game Platform // Copyright (C) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- #endregion #region Using Statements using System; using Microsoft.Xna.Framework; #endregion namespace NetRumble { /// /// A weapon that shoots a rockets. /// public class RocketWeapon : Weapon { #region Initialization Methods /// /// Constructs a new rocket-launching weapon. /// /// The ship that owns this weapon. public RocketWeapon(Ship owner) : base(owner) { fireDelay = 0.5f; // Pick one of the rocket sound variations for this instance. if (RandomMath.Random.Next(2) == 0) fireSoundEffect = "fire_rocket1"; else fireSoundEffect = "fire_rocket2"; } #endregion #region Interaction Methods /// /// Create and spawn the projectile(s) from a firing from this weapon. /// /// The direction that the projectile will move. protected override void CreateProjectiles(Vector2 direction) { // create the new projectile RocketProjectile projectile = new RocketProjectile(owner, direction); projectile.Initialize(); owner.Projectiles.Add(projectile); } #endregion } }