/// <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);
        }
        /// <summary>
        /// Créé un IA qui se dirige vers le joueur toutes les x secondes et tir
        /// </summary>
        /// <param name="pX">position en Y initiale</param>
        /// <param name="pY">position en X initiale</param>
        /// <param name="pDegree">degré initial</param>
        /// <param name="pRotateSpeed">vitesse de rotation</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 GenerateCirclingEnnemi(float pX, float pY, int pDegree, float pRotateSpeed = 1.5f, float speed = 4, int delayShoot = 1000)
        {
            ActionMouvement mouvement;
            EnnemyShip      enemyShip = new EnnemyShip();

            enemyShip                   = new EnnemyShip(false);
            enemyShip.Position          = new Vector2(pX, pY);
            enemyShip.Speed             = new Vector2(speed, 0);
            enemyShip.RotationInDegrees = pDegree;
            enemyShip.setSpeedWithDirection();
            mouvement           = new ActionMouvement(enemyShip);
            mouvement.Recursive = true;
            mouvement.setRotation(pRotateSpeed);

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

            return(enemyShip);
        }
        /// <summary>
        /// Créé un IA qui se dirige vers le joueur toutes les x secondes et tir
        /// </summary>
        /// <param name="pX">position en Y initiale</param>
        /// <param name="pY">position en X initiale</param>
        /// <param name="pDegree">degré initial</param>
        /// <param name="pRotateSpeed">vitesse de rotation</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 GenerateCirclingEnnemi(float pX, float pY, int pDegree, float pRotateSpeed = 1.5f,float speed = 4, int delayShoot = 1000)
        {
            ActionMouvement mouvement;
            EnnemyShip enemyShip = new EnnemyShip();

            enemyShip = new EnnemyShip(false);
            enemyShip.Position = new Vector2(pX, pY);
            enemyShip.Speed = new Vector2(speed, 0);
            enemyShip.RotationInDegrees = pDegree;
            enemyShip.setSpeedWithDirection();
            mouvement = new ActionMouvement(enemyShip);
            mouvement.Recursive = true;
            mouvement.setRotation(pRotateSpeed);

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

            return enemyShip;
        }
        /// <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;
        }
Exemplo n.º 5
0
 public ActionDefend(EnnemyShip ship, DefenseBase shield)
 {
 }
Exemplo n.º 6
0
 public ActionShoot(EnnemyShip ship, Weapon arme, int delay = 0, int sleep = 0)
 {
     _time = delay;
     _initialTime = delay;
     _timePaused = sleep;
     _ship = ship;
     _weapon = arme;
     Recursive = true;
 }
Exemplo n.º 7
0
 public ActionMouvement(EnnemyShip ship, int delay = 0, int sleep = 0)
 {
     _time = delay;
     _timePaused = sleep;
     _initialTime = delay;
     _ship = ship;
 }
Exemplo n.º 8
0
 public ActionFollowPlayer(EnnemyShip ship,Ship playerShip, float laserSpeed = Laser.LASER_SPEED, int minMaxError = 0,int delay = 0, int sleep = 0)
 {
     _time = delay;
     _timePaused = sleep;
     _initialTime = delay;
     _ship = ship;
     _playerShip = playerShip;
     _laserSpeed = laserSpeed + _ship.Speed.Length();
     _randMiss = new Vector2(Utilities.Utilitaire._random.Next(-minMaxError, minMaxError), Utilities.Utilitaire._random.Next(-minMaxError, minMaxError));
 }
Exemplo n.º 9
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;
        }