protected override void SecondaryShootingPattern(GameTime gameTime)
        {
            double width         = 2 * Math.PI;
            int    numberOfShots = 6;

            double randomOffset = random.NextDouble() * Math.PI * 2;

            List <double> spreadDirections = MathFunctions.GetSpreadDirList(width, numberOfShots);

            foreach (double dir in spreadDirections)
            {
                EnemyWeakRedLaser laser1 = new EnemyWeakRedLaser(Game, spriteSheet);
                laser1.PositionX = PositionX;
                laser1.PositionY = PositionY;

                double shootDir = dir + randomOffset;

                laser1.Direction = MathFunctions.DirFromRadians(shootDir);
                laser1.Initialize();
                laser1.Speed    *= 1.0f;
                laser1.Duration *= 0.4f;

                Game.stateManager.shooterState.gameObjects.Add(laser1);
            }
        }
        protected override void SecondaryShootingPattern(GameTime gameTime)
        {
            double width         = Math.PI;
            double numberOfShots = 7;

            List <double> spreadDirections = MathFunctions.GetSpreadDirList(width, numberOfShots);

            int shotNbr    = 0;
            int centerShot = (int)(numberOfShots / 2) + 1;

            foreach (double dir in spreadDirections)
            {
                shotNbr++;
                if (shotNbr == centerShot)
                {
                    continue;
                }

                EnemyWeakRedLaser laser = new EnemyWeakRedLaser(Game, spriteSheet);
                laser.Position  = Position;
                laser.Direction = MathFunctions.DirFromRadians(dir);
                laser.Initialize();

                laser.Speed    *= 0.3f;
                laser.Duration *= 1.5f;

                Game.stateManager.shooterState.gameObjects.Add(laser);
            }
        }
        public override void Setup(GameObjectVertical obj)
        {
            Vector2 centerDir = new Vector2(0, 1.0f);

            double dirRadians = MathFunctions.RadiansFromDir(centerDir);

            dirRadians += random.NextDouble() * 3 * Math.PI / 24 - Math.PI / 24;

            obj.Direction = MathFunctions.DirFromRadians(dirRadians);
        }
        protected override void ShootingPattern(GameTime gameTime)
        {
            AllianceHangarAttackShip ship = new AllianceHangarAttackShip(Game, spriteSheet, player);

            ship.Position  = Position;
            ship.Direction = MathFunctions.DirFromRadians(Math.PI);
            ship.Initialize();
            ship.SetMovement(Movement.SearchAndLockOn);
            ship.Speed       *= 0.8f;
            ship.TurningSpeed = 2f;

            Game.AddGameObjToShooter(ship);
        }
Exemple #5
0
        //Hanterar "shooting"
        protected override void ShootingPattern(GameTime gameTime)
        {
            double width         = Math.PI / 6;
            int    numberOfShots = 5;

            for (double dir = -width / 2 + Math.PI / 2; dir <= width / 2 + Math.PI / 2; dir += (width / numberOfShots))
            {
                EnemyHomingMissileBullet bullet = new EnemyHomingMissileBullet(Game, spriteSheet, player);
                bullet.Position  = Position;
                bullet.Direction = MathFunctions.DirFromRadians(dir);
                bullet.Initialize();

                Game.stateManager.shooterState.gameObjects.Add(bullet);
            }
        }
Exemple #6
0
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            double width = Math.PI / 6;

            for (double dir = -width / 2 - Math.PI / 2; dir <= width / 2 - Math.PI / 2; dir += (width / numberOfShots))
            {
                GreenBullet bullet = new GreenBullet(Game, spriteSheet);
                bullet.Position  = player.Position;
                bullet.Direction = MathFunctions.DirFromRadians(dir);
                bullet.Initialize();
                bullet.Damage = damage;

                Game.stateManager.shooterState.gameObjects.Add(bullet);
            }
            return(true);
        }
        protected override void ShootingPattern(GameTime gameTime)
        {
            Vector2 centerDir  = new Vector2(0, 1.0f);
            double  dirRadians = MathFunctions.RadiansFromDir(centerDir);

            dirRadians += random.NextDouble() * Math.PI / 8 - Math.PI / 16;

            EnemyMine mine = new EnemyMine(Game, spriteSheet, player);

            mine.Position  = Position;
            mine.Direction = MathFunctions.DirFromRadians(dirRadians);
            mine.Initialize();

            mine.SetActivationTime(mineActivationTime);

            Game.stateManager.shooterState.gameObjects.Add(mine);
        }
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            Vector2 centerDir  = new Vector2(0, -1.0f);
            double  dirRadians = MathFunctions.RadiansFromDir(centerDir);

            dirRadians += random.NextDouble() * Math.PI / 2 - Math.PI / 4;

            RegularBomb bomb = new RegularBomb(Game, spriteSheet);

            bomb.Position  = player.Position;
            bomb.Direction = MathFunctions.DirFromRadians(dirRadians);
            bomb.Initialize();
            bomb.Damage = damage;

            Game.stateManager.shooterState.gameObjects.Add(bomb);
            return(true);
        }
Exemple #9
0
        private List <Vector2> GetRandomCoordinateFields(int count, double radius, double emptyInnerRadius = 0)
        {
            List <Vector2> coordList = new List <Vector2>();

            for (int n = 0; n < count; n++)
            {
                double r   = MathFunctions.GetExternalRandomDouble() * (radius - emptyInnerRadius) + emptyInnerRadius;
                double rad = MathFunctions.GetExternalRandomDouble() * Math.PI * 2;

                Vector2 coord = new Vector2((float)(MathFunctions.DirFromRadians(rad).X *r),
                                            (float)(MathFunctions.DirFromRadians(rad).Y *r));

                coordList.Add(coord);
            }

            return(coordList);
        }
Exemple #10
0
        protected override void ShootingPattern(GameTime gameTime)
        {
            double width         = Math.PI / 6;
            int    numberOfShots = 3;

            for (double dir = Math.PI / 2 - width / 2; dir <= Math.PI / 2 + width / 2; dir += (width / (numberOfShots - 1)))
            {
                EnemyWeakBlueLaser laser1 = new EnemyWeakBlueLaser(Game, spriteSheet);
                laser1.Position  = Position;
                laser1.Direction = MathFunctions.DirFromRadians(dir);
                laser1.Initialize();
                laser1.Duration *= 10;
                laser1.DrawLayer = this.DrawLayer - 0.01f;

                Game.AddGameObjToShooter(laser1);
            }
        }
Exemple #11
0
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            Vector2 dir1 = MathFunctions.DirFromRadians(-Math.PI / 2 - (6 * Math.PI / 32));
            Vector2 dir2 = MathFunctions.DirFromRadians(-Math.PI / 2 - (4 * Math.PI / 32));
            Vector2 dir3 = MathFunctions.DirFromRadians(-Math.PI / 2 - (2 * Math.PI / 32));
            Vector2 dir4 = MathFunctions.DirFromRadians(-Math.PI / 2 + (2 * Math.PI / 32));
            Vector2 dir5 = MathFunctions.DirFromRadians(-Math.PI / 2 + (4 * Math.PI / 32));
            Vector2 dir6 = MathFunctions.DirFromRadians(-Math.PI / 2 + (6 * Math.PI / 32));

            //CreateMissile(player, -4, dir1);
            CreateMissile(player, -3, dir2, speedFactor: 0.8f);
            CreateMissile(player, -2, dir3, speedFactor: 1.5f);
            CreateMissile(player, 2, dir4, speedFactor: 1.5f);
            CreateMissile(player, 3, dir5, speedFactor: 0.8f);
            //CreateMissile(player, 4, dir6);

            return(true);
        }
        protected override void ShootingPattern(GameTime gameTime)
        {
            double width         = Math.PI / 12;
            double numberOfShots = 3;

            foreach (double dir in MathFunctions.GetSpreadDirList(width, numberOfShots))
            {
                EnemyWeakBlueLaser laser1 = new EnemyWeakBlueLaser(Game, spriteSheet);
                laser1.PositionX = PositionX;
                laser1.PositionY = PositionY;
                laser1.Direction = MathFunctions.DirFromRadians(dir);
                laser1.Initialize();
                laser1.Speed    *= 1.5f;
                laser1.Duration *= 2.0f;

                Game.stateManager.shooterState.gameObjects.Add(laser1);
            }
        }
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            Vector2 centerDir  = new Vector2(0, -1.0f);
            double  dirRadians = MathFunctions.RadiansFromDir(centerDir);

            dirRadians += random.NextDouble() * Math.PI / 8 - Math.PI / 16;

            Mine mine = new Mine(Game, spriteSheet);

            mine.Position  = player.Position;
            mine.Direction = MathFunctions.DirFromRadians(dirRadians);
            mine.Initialize();
            mine.Speed    = 0.03f;
            mine.Duration = 20000;

            Game.stateManager.shooterState.gameObjects.Add(mine);
            return(true);
        }
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            Vector2 centerDir = new Vector2(0, -1.0f);

            double dirRadians = MathFunctions.RadiansFromDir(centerDir);

            dirRadians += random.NextDouble() * 2 * Math.PI / 12 - Math.PI / 12;

            YellowBullet bullet = new YellowBullet(Game, spriteSheet);

            bullet.Position  = player.Position;
            bullet.Direction = MathFunctions.DirFromRadians(dirRadians);
            bullet.Initialize();

            bullet.SetSpreadSpeed(random);

            Game.stateManager.shooterState.gameObjects.Add(bullet);
            return(true);
        }
Exemple #15
0
        public override Boolean Activate(PlayerVerticalShooter player, GameTime gameTime)
        {
            float speedFactor    = 0.5f;
            float durationFactor = 1f;

            for (int dir = -sideShots; dir <= sideShots; dir++)
            {
                AdvancedLaser shot1 = new AdvancedLaser(Game, spriteSheet);
                shot1.PositionX = player.PositionX;
                shot1.PositionY = player.PositionY;
                BasicBulletSetup(shot1);
                shot1.Radians   = MathFunctions.RadiansFromDir(shot1.Direction) - dir * Math.PI / 30;
                shot1.Direction = MathFunctions.DirFromRadians(shot1.Radians);
                shot1.Speed    *= speedFactor;
                shot1.Duration *= durationFactor;

                Game.stateManager.shooterState.gameObjects.Add(shot1);
            }

            return(true);
        }
        private void HandleShooting(GameTime gameTime)
        {
            lastTimeShot += gameTime.ElapsedGameTime.Milliseconds;

            if (lastTimeShot >= shootingDelay)
            {
                lastTimeShot -= shootingDelay;

                double width         = Math.PI;
                int    numberOfShots = 4;

                for (double dir = -width / 2 + Math.PI / 2; dir <= width / 2 + Math.PI / 2; dir += (width / numberOfShots))
                {
                    EnemyHomingBullet bullet = new EnemyHomingBullet(Game, spriteSheet, player);
                    bullet.Position  = Position;
                    bullet.Direction = MathFunctions.DirFromRadians(dir);
                    bullet.Initialize();

                    Game.stateManager.shooterState.gameObjects.Add(bullet);
                    Game.soundEffectsManager.PlaySoundEffect(SoundEffects.SmallLaser, soundPan);
                }
            }
        }