/// <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); }
protected override List <MovingObject> GetIAs(Ship playerShip) { EnnemyShip enemyShip; ActionMouvement mouvement; ActionShoot shoot; List <MovingObject> retour = new List <MovingObject>(); for (int i = 150; i < 250; i++) { enemyShip = new EnnemyShip(false); enemyShip.Position = new Vector2(i * 1 + 500, i * 1 + 500); enemyShip.Speed = new Vector2(0, 13); mouvement = new ActionMouvement(enemyShip, 0, 0); mouvement.Recursive = true; mouvement.setRotation((float)(i) / 200f); Weapon wep = new Weapon(enemyShip, 500); shoot = new ActionShoot(enemyShip, wep, 10, 0); shoot.ActOnDegree = true; shoot.DegreeToAct = i * 360 / 1000; enemyShip.AddAction(mouvement); enemyShip.AddAction(shoot); if (i % 10 == 0) { enemyShip.AddAction(new ActionShoot(enemyShip, new FrostOrb(enemyShip, 4000), 5000, 0)); } else if (i % 5 == 0) { enemyShip.AddAction(new ActionShoot(enemyShip, new Weapon(enemyShip, 1000), 5000, 0)); } retour.Add(enemyShip); } return(retour); }