protected virtual void IA(List <Unite> unitsOnMap) { // Cast un heal si < à la moitié de vie if (Vie <= VieMax / 2 && IsCastable(0)) { Cast(spells[0], Vector2.Zero, null); } if (uniteAttacked != null) { if (IsRanged && NiveauDeBrain >= 3) { NiveauDeBrain = 0; // represente tous les noeuds possibles pour se rapprocher de la cible List <Noeud> Chemin = PathFinding.TrouverChemin(PositionTile, uniteAttacked.PositionTile, Map.Taille, new List <Unite> { }, Map.unitesStatic, false); Projectile = new Projectile(this, uniteAttacked); if (Chemin != null) { foreach (Noeud n in Chemin) // Pour chaque noeud possible { if (Projectile.CanReach(n.Position)) // Si on peut atteindre sa cible depuis ce noeud { ObjectifListe = new List <Noeud> { }; foreach (Noeud n2 in Chemin) // Alors on se déplace sur ce noeud { if (n2 != n) { ObjectifListe.Add(n2); } else { ObjectifListe.Add(n2); break; } } break; } } } OlduniteAttacked = uniteAttacked; uniteAttacked = null; } } }
protected virtual void IA(List<Unite> unitsOnMap) { // Cast un heal si < à la moitié de vie if (Vie <= VieMax / 2 && IsCastable(0)) Cast( spells[0], Vector2.Zero, null); if (uniteAttacked != null) { if (IsRanged && NiveauDeBrain >= 3) { NiveauDeBrain = 0; // represente tous les noeuds possibles pour se rapprocher de la cible List<Noeud> Chemin = PathFinding.TrouverChemin(PositionTile, uniteAttacked.PositionTile, Map.Taille, new List<Unite> { }, Map.unitesStatic, false); Projectile = new Projectile(this, uniteAttacked); if (Chemin != null) { foreach (Noeud n in Chemin) // Pour chaque noeud possible { if (Projectile.CanReach(n.Position)) // Si on peut atteindre sa cible depuis ce noeud { ObjectifListe = new List<Noeud> { }; foreach (Noeud n2 in Chemin) // Alors on se déplace sur ce noeud { if (n2 != n) ObjectifListe.Add(n2); else { ObjectifListe.Add(n2); break; } } break; } } } OlduniteAttacked = uniteAttacked; uniteAttacked = null; } } }