Example #1
0
        /// <summary>
        /// Create and spawn the projectile(s) from a firing from this weapon.
        /// </summary>
        /// <param name="direction">The direction that the projectile will move.</param>
        protected override void CreateProjectiles(Vector2 direction)
        {
            // calculate the direction vectors for the second and third projectiles
            float rotation = (float)Math.Acos(Vector2.Dot(new Vector2(0f, -1f),
                                                          direction));

            rotation *= (Vector2.Dot(new Vector2(0f, -1f),
                                     new Vector2(direction.Y, -direction.X)) > 0f) ? 1f : -1f;
            Vector2 direction2 = new Vector2(
                (float)Math.Sin(rotation - laserSpreadRadians),
                -(float)Math.Cos(rotation - laserSpreadRadians));
            Vector2 direction3 = new Vector2(
                (float)Math.Sin(rotation + laserSpreadRadians),
                -(float)Math.Cos(rotation + laserSpreadRadians));

            // create the first projectile
            LaserProjectile projectile = new LaserProjectile(owner.World, owner,
                                                             direction);

            // spawn the projectile
            projectile.Spawn(false);

            // create the second projectile
            projectile = new LaserProjectile(owner.World, owner,
                                             direction2);
            // spawn the projectile
            projectile.Spawn(false);

            // create the third projectile
            projectile = new LaserProjectile(owner.World, owner,
                                             direction3);
            // spawn the projectile
            projectile.Spawn(false);
        }
        /// <summary>
        /// Create and spawn the projectile(s) from a firing from this weapon.
        /// </summary>
        /// <param name="direction">The direction that the projectile will move.</param>
        protected override void CreateProjectiles(Vector2 direction)
        {
            // calculate the direction vectors for the second and third projectiles
            float rotation = (float)Math.Acos(Vector2.Dot(new Vector2(0f, -1f),
                direction));
            rotation *= (Vector2.Dot(new Vector2(0f, -1f),
                new Vector2(direction.Y, -direction.X)) > 0f) ? 1f : -1f;
            Vector2 direction2 = new Vector2(
                 (float)Math.Sin(rotation - laserSpreadRadians),
                -(float)Math.Cos(rotation - laserSpreadRadians));
            Vector2 direction3 = new Vector2(
                 (float)Math.Sin(rotation + laserSpreadRadians),
                -(float)Math.Cos(rotation + laserSpreadRadians));

            // create the first projectile
            LaserProjectile projectile = new LaserProjectile(owner.World, owner,
                direction);
            // spawn the projectile
            projectile.Spawn(false);

            // create the second projectile
            projectile = new LaserProjectile(owner.World, owner,
                direction2);
            // spawn the projectile
            projectile.Spawn(false);

            // create the third projectile
            projectile = new LaserProjectile(owner.World, owner,
                direction3);
            // spawn the projectile
            projectile.Spawn(false);
        }
 /// <summary>
 /// Create and spawn the projectile(s) from a firing from this weapon.
 /// </summary>
 /// <param name="direction">The direction that the projectile will move.</param>
 protected override void CreateProjectiles(Vector2 direction)
 {
     // create the new projectile
     LaserProjectile projectile = new LaserProjectile(owner.World, owner,
         direction);
     // spawn the projectile
     projectile.Spawn(false);
 }
        /// <summary>
        /// Create and spawn the projectile(s) from a firing from this weapon.
        /// </summary>
        /// <param name="direction">The direction that the projectile will move.</param>
        protected override void CreateProjectiles(Vector2 direction)
        {
            // create the new projectile
            LaserProjectile projectile = new LaserProjectile(owner.World, owner,
                                                             direction);

            // spawn the projectile
            projectile.Spawn(false);
        }
        /// <summary>
        /// Create and spawn the projectile(s) from a firing from this weapon.
        /// </summary>
        /// <param name="direction">The direction that the projectile will move.</param>
        protected override void CreateProjectiles(Vector2 direction)
        {
            // calculate the spread of the laser bolts
            Vector2 cross = Vector2.Multiply(new Vector2(-direction.Y, direction.X),
                laserSpread);

            // create the new projectile
            LaserProjectile projectile = new LaserProjectile(owner.World, owner,
                direction);
            // adjust the position for the laser spread
            projectile.Position += cross;
            // spawn the projectile
            projectile.Spawn(false);

            // create the second projectile
            projectile = new LaserProjectile(owner.World, owner, direction);
            // adjust the position for the laser spread
            projectile.Position -= cross;
            // spawn the projectile
            projectile.Spawn(false);
        }
Example #6
0
        /// <summary>
        /// Create and spawn the projectile(s) from a firing from this weapon.
        /// </summary>
        /// <param name="direction">The direction that the projectile will move.</param>
        protected override void CreateProjectiles(Vector2 direction)
        {
            // calculate the spread of the laser bolts
            Vector2 cross = Vector2.Multiply(new Vector2(-direction.Y, direction.X),
                                             laserSpread);

            // create the new projectile
            LaserProjectile projectile = new LaserProjectile(owner.World, owner,
                                                             direction);

            // adjust the position for the laser spread
            projectile.Position += cross;
            // spawn the projectile
            projectile.Spawn(false);

            // create the second projectile
            projectile = new LaserProjectile(owner.World, owner, direction);
            // adjust the position for the laser spread
            projectile.Position -= cross;
            // spawn the projectile
            projectile.Spawn(false);
        }