#region File Description
//-----------------------------------------------------------------------------
// MineWeapon.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 fires a single mine on a long timer.
///
public class MineWeapon : Weapon
{
#region Constants
///
/// The distance that the mine spawns behind the ship.
///
const float mineSpawnDistance = 8f;
#endregion
#region Initialization Methods
///
/// Constructs a new mine-laying weapon.
///
/// The ship that owns this weapon.
public MineWeapon(Ship owner)
: base(owner)
{
fireDelay = 2f;
}
#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
MineProjectile projectile = new MineProjectile(owner, direction);
projectile.Initialize();
owner.Projectiles.Add(projectile);
// move the mine out from the ship
projectile.Position = owner.Position +
direction * (owner.Radius + projectile.Radius + mineSpawnDistance);
}
#endregion
}
}