/// <summary> /// Constructs a new projectile. /// </summary> /// <param name="world">The world that this projectile belongs to.</param> /// <param name="owner">The ship that fired this projectile, if any.</param> /// <param name="direction">The initial direction for this projectile.</param> public Projectile(World world, Ship owner, Vector2 direction) : base(world) { this.owner = owner; this.position = owner.Position; this.velocity = direction; }
/// <summary> /// Constructs a new weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public Weapon(Ship owner) { if (owner == null) { throw new ArgumentNullException("owner"); } this.owner = owner; }
/// <summary> /// Constructs a new laser projectile. /// </summary> /// <param name="world">The world that this projectile belongs to.</param> /// <param name="owner">The ship that fired this projectile, if any.</param> /// <param name="direction">The initial direction for this projectile.</param> public LaserProjectile(World world, Ship owner, Vector2 direction) : base(world, owner, direction) { this.radius = 0.5f; this.speed = 640f; this.duration = 5f; this.damageAmount = 20f; this.damageOwner = false; this.mass = 0.5f; this.explodes = false; this.explosionColors = new Color[] { Color.White, Color.Gray, Color.Gray, Color.Silver, Color.Yellow }; }
/// <summary> /// Constructs a new rocket projectile. /// </summary> /// <param name="world">The world that this projectile belongs to.</param> /// <param name="owner">The ship that fired this projectile, if any.</param> /// <param name="direction">The initial direction for this projectile.</param> public RocketProjectile(World world, Ship owner, Vector2 direction) : base(world, owner, direction) { this.radius = 8f; this.life = 80f; this.mass = 3f; this.speed = 520f; this.duration = 4f; this.damageAmount = 100f; this.damageOwner = false; this.damageRadius = 128f; this.explodes = true; this.explosionColors = new Color[] { Color.Orange, Color.Gray, Color.Gray, Color.Silver }; this.polygon = VectorPolygon.CreateRocket(); this.color = Color.Orange; }
/// <summary> /// Constructs a new mine projectile. /// </summary> /// <param name="world">The world that this projectile belongs to.</param> /// <param name="owner">The ship that fired this projectile, if any.</param> /// <param name="direction">The initial direction for this projectile.</param> public MineProjectile(World world, Ship owner, Vector2 direction) : base(world, owner, direction) { this.radius = 16f; this.life = 15f; this.speed = 64f; this.duration = 15f; this.mass = 5f; this.damageAmount = 200f; this.damageOwner = true; this.damageRadius = 80f; this.explodes = true; this.explosionColors = new Color[] { Color.Red, Color.Maroon, Color.White, Color.Silver }; this.polygon = VectorPolygon.CreateMine(); this.color = Color.Red; }
/// <summary> /// Constructs a new rocket-launching weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public RocketWeapon(Ship owner) : base(owner) { fireDelay = 0.75f; fireCueName = "rocketFire"; }
/// <summary> /// Constructs a new double-laser weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public DoubleLaserWeapon(Ship owner) : base(owner) { }
/// <summary> /// Constructs a new laser weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public LaserWeapon(Ship owner) : base(owner) { fireDelay = 0.15f; fireCueName = "laserBlaster"; }
/// <summary> /// Construct a new World object, holding the game simulation. /// </summary> public World(Vector2 dimensions) { this.dimensions = dimensions; safeDimensions = new Rectangle( (int)(dimensions.X * 0.05f), (int)(dimensions.Y * 0.05f), (int)(dimensions.X * 0.90f), (int)(dimensions.Y * 0.90f)); // create the players ships = new Ship[4]; ships[0] = new Ship(this, PlayerIndex.One); ships[1] = new Ship(this, PlayerIndex.Two); ships[2] = new Ship(this, PlayerIndex.Three); ships[3] = new Ship(this, PlayerIndex.Four); // create the starfield starfield = new Starfield(starCount, new Rectangle( starfieldBuffer * -1, starfieldBuffer * -1, (int)this.dimensions.X + starfieldBuffer * 2, (int)this.dimensions.Y + starfieldBuffer * 2)); // create a new list of actors actors = new CollectCollection<Actor>(this); // create a new list of particle systems particleSystems = new CollectCollection<ParticleSystem>(this); }
/// <summary> /// Constructs a new mine-laying weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public MineWeapon(Ship owner) : base(owner) { fireDelay = 2f; }
/// <summary> /// Constructs a new triple-laser weapon. /// </summary> /// <param name="owner">The ship that owns this weapon.</param> public TripleLaserWeapon(Ship owner) : base(owner) { }