/// <summary>
        /// Créé un IA qui se dirige vers le joueur toutes les x secondes et tir
        /// </summary>
        /// <param name="playerShip">Référense vers le joueur</param>
        /// <param name="speed">vitesse de l'ennemi (3 par défaut)</param>
        /// <param name="delayShoot">millisecondes entre les tirs</param>
        /// <returns></returns>
        public static EnnemyShip GenerateSimpleEnnemi(Ship playerShip, float speed = 3, int delayShoot = 1000)
        {
            ActionFollowPlayer mouvement;
            EnnemyShip         enemyShip = new EnnemyShip();

            enemyShip                   = new EnnemyShip(false);
            enemyShip.Position          = new Vector2(Utilitaire._random.Next(0, GameManager.GameManager._WidthGame), Utilitaire._random.Next(0, GameManager.GameManager._HeightGame));
            enemyShip.Speed             = new Vector2(speed, 0);
            enemyShip.RotationInDegrees = Utilitaire._random.Next(0, 360);
            enemyShip.setSpeedWithDirection();
            mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 0, 5000);

            mouvement.Recursive = true;

            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip, 300), delayShoot, (int)(delayShoot)));

            return(enemyShip);
        }
Beispiel #2
0
        protected override List <MovingObject> GetIAs(Ship playerShip)
        {
            EnnemyShip          enemyShip;
            ActionFollowPlayer  mouvement;
            List <MovingObject> retour = new List <MovingObject>();
            Weapon wep;

            for (int i = 10; i < 100; i++)
            {
                enemyShip          = new EnnemyShip(false);
                enemyShip.Position = new Vector2(10 + i * 30, 100);
                enemyShip.Speed    = new Vector2(3, 0);
                if (i % 5 != 0)
                {//nous visent au 5 sec, tirent aux 2 sec
                    mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120, 5000);
                }
                else
                {//suivent toujours
                    mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
                }
                mouvement.Recursive = true;
                wep = new Weapon(enemyShip, 500);

                enemyShip.AddAction(mouvement);
                enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip, 2000), 2000, (int)(2000)));

                retour.Add(enemyShip);
            }
            //Enemis tourrelles*
            enemyShip           = new EnnemyShip(false);
            enemyShip.Position  = new Vector2(100, GetHeight() - 100);
            enemyShip.Speed     = new Vector2(0, 0);
            mouvement           = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);
            //tourelle 2
            enemyShip           = new EnnemyShip(false);
            enemyShip.Position  = new Vector2(100, 100);
            enemyShip.Speed     = new Vector2(0, 0);
            mouvement           = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);
            //tourelle 3

            enemyShip           = new EnnemyShip(false);
            enemyShip.Position  = new Vector2(GetWidth() - 100, 100);
            enemyShip.Speed     = new Vector2(0, 0);
            mouvement           = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            retour.Add(enemyShip);
            //tourelle 4
            enemyShip           = new EnnemyShip(false);
            enemyShip.Position  = new Vector2(GetWidth() - 100, GetHeight() - 100);
            enemyShip.Speed     = new Vector2(0, 0);
            mouvement           = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);


            return(retour);
        }
Beispiel #3
0
        protected override List<MovingObject> GetIAs(Ship playerShip)
        {
            EnnemyShip enemyShip;
            ActionFollowPlayer mouvement;
            List<MovingObject> retour = new List<MovingObject>();
            Weapon wep;
            for (int i = 10;i<100 ; i++)
            {
                enemyShip = new EnnemyShip(false);
                enemyShip.Position = new Vector2(10 + i * 30,100);
                enemyShip.Speed = new Vector2(3, 0);
                if (i % 5 != 0)
                {//nous visent au 5 sec, tirent aux 2 sec
                    mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120, 5000);
                }
                else
                {//suivent toujours
                    mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
                }
                mouvement.Recursive = true;
                wep = new Weapon(enemyShip, 500);

                enemyShip.AddAction(mouvement);
                enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip, 2000), 2000, (int)( 2000)));

                retour.Add(enemyShip);
            }
            //Enemis tourrelles*
            enemyShip = new EnnemyShip(false);
            enemyShip.Position = new Vector2(100, GetHeight()-100);
            enemyShip.Speed = new Vector2(0, 0);
            mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);
            //tourelle 2
            enemyShip = new EnnemyShip(false);
            enemyShip.Position = new Vector2(100, 100);
            enemyShip.Speed = new Vector2(0, 0);
            mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);
            //tourelle 3

            enemyShip = new EnnemyShip(false);
            enemyShip.Position = new Vector2(GetWidth()-100, 100);
            enemyShip.Speed = new Vector2(0, 0);
            mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            retour.Add(enemyShip);
            //tourelle 4
            enemyShip = new EnnemyShip(false);
            enemyShip.Position = new Vector2(GetWidth()-100, GetHeight()-100);
            enemyShip.Speed = new Vector2(0, 0);
            mouvement = new ActionFollowPlayer(enemyShip, playerShip, Laser.LASER_SPEED, 120);
            mouvement.Recursive = true;
            wep = new ShotGun(enemyShip, 1500);
            enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip), 1000));
            enemyShip.AddAction(mouvement);
            enemyShip.AddAction(new ActionShoot(enemyShip, wep, 5000));
            retour.Add(enemyShip);

            return retour;
        }