public Bump(Unite u, bool useMana = true) : base(u) { Cooldown = 0; SpriteBouton = PackTexture.sorts[0]; }
public PotionDeVie(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[3]; spell = new Soin(unite, false); id = 1; }
public PotionDeMana(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[4]; spell = new RegenMana(unite, false); id = 2; }
public Item(Unite unite, Vector2 position) { this.unite = unite; Position = position; Icone = PackTexture.blank; // definir l'icone ici type = Type.Consommable; }
public Invisibilite(Unite u, bool useMana = true) : base(u) { idSort = 3; Cooldown = 5; Ticks = 300; if (useMana) { CoutMana = 30; } else { CoutMana = 0; } Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[2]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.InvisibiliteCible); uniteFollowing = new List <Unite>(); description1 = new Text("DescriptionInvisibilite1"); description2 = new Text("DescriptionInvisibilite2"); }
public Unite unite; // Unite qui possède l'objet #endregion Fields #region Constructors public Item(Unite unite, Vector2 position) { this.unite = unite; Position = position; Icone = PackTexture.blank; // definir l'icone ici type = Type.Consommable; }
void SendSpell(Player p) { if (champion.isCasting) { Unite u = champion; List <Spell> toutLesSpellsPossibles = new List <Spell> { new Explosion(u), new Soin(u), new Invisibilite(u), new FurieSanguinaire(u), new Polymorphe(u), new Tempete(u) }; foreach (Spell s in toutLesSpellsPossibles) { if (s.idSort == spell.idSort) { p.idSortCast = s.idSort; p.pointSortX = champion.pointCible.X; p.pointSortY = champion.pointCible.Y; if (SelectedUnit != null) { p.idUniteCibleCast = SelectedUnit.id; } break; } } champion.isCasting = false; champion.pointCible = Vector2.Zero; } }
public Soin(Unite u, bool useMana = true) : base(u) { idSort = 6; Cooldown = 1; Ticks = 1; if (useMana) { CoutMana = 15; } else { CoutMana = 0; } Animation = PackAnimation.Soin(); AnimationReset = PackAnimation.Soin(); Tiles = new Vector2(180 / 5, 35); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[1]; SpriteEffect = PackTexture.sorts[1]; sonSort = new EffetSonore(PackSon.Soin); description1 = new Text("DescriptionSoin1"); description2 = new Text("DescriptionSoin2"); }
public Projectile(Unite tireur, Unite target) { Sprite = tireur.ProjectileSprite; Position = ConvertUnits.ToDisplayUnits(tireur.body.Position); Tireur = tireur; Target = target; Vitesse = 14; Timer = (int)Outil.DistanceUnites(tireur, target) / Vitesse; }
public Joueur(Unite champ) { champion = champ; // Statistiques champion.Drawlife = true; champion.isAChamp = true; camera = new Camera2D(Vector2.Zero); Interface = new UI(this); }
// MORT public virtual List <Vector2> Mort(Unite unite) { List <Vector2> liste = new List <Vector2> { }; if (unite is Cavalier) { liste.Add(new Vector2(0, 10)); } else if (unite is Archer) { liste.Add(new Vector2(4, 7)); } else if (unite is Troll) { liste.Add(new Vector2(4, 9)); } else if (unite is Grunt) { liste.Add(new Vector2(0, 10)); } else if (unite is Demon) { liste.Add(new Vector2(0, 10)); } else if (unite is Ogre) { liste.Add(new Vector2(0, 10)); } else if (unite is Guerrier) { liste.Add(new Vector2(0, 10)); } else if (unite is Odin) { liste.Add(new Vector2(3, 0)); } else if (unite is Voleur) { liste.Add(new Vector2(0, 9)); } else if (unite is Chasseur) { liste.Add(new Vector2(0, 9)); } else { throw new Exception("T'as pas modif la classe packanimation!"); } return(liste); }
public virtual void Begin(Vector2 p, Unite unit) { LastCast = (float)Map.gametime.TotalGameTime.TotalMilliseconds; Activated = true; TickCurrent = 0; if (sonSort != null) { sonSort.Play(); } unite.Mana -= CoutMana; Point = p; UniteCible = unit; }
public void Cast(Spell s, Vector2 point, Unite unit, bool fromOnline = false) { // Cast ou initialise le sort s.Point = point; s.UniteCible = unit; if (SceneHandler.gameplayScene.isCoopPlay && !fromOnline) { isCasting = true; } else { spellsUpdate.Add(s); spellsUpdate[spellsUpdate.Count - 1].Begin(point, unit); } }
public BottesDacier(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[7]; type = Type.Bottes; VieBonus = 0; DommagesBonus = 0; ManaBonus = 0; ArmureBonus = 0; ManaRegenBonus = 0; PuissanceBonus = 0; VitesseBonus = 0.05f; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 3; }
// Appelé quand l'objet est sur la Map public void Update(List<Unite> unites) { foreach (Unite u in unites) { if (u.isAChamp && Outil.DistancePoints(Position, u.PositionTile) <= 32 && !InInventory) { if (u.Inventory.Count + 1 <= u.InventoryCapacity) { unite = u; u.Inventory.Add(this); InInventory = true; // retire l'objet de la carte et l'ajoute a l'inventaire de l'unité proche Effet(u); } } } }
public Epaulieres(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[8]; type = Type.Epaulieres; VieBonus = 0; DommagesBonus = 0; ManaBonus = 0; ArmureBonus = 5; ManaRegenBonus = 0; PuissanceBonus = 0; VitesseBonus = 0; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 4; }
public RingLionHead(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[11]; type = Type.Anneau; VieBonus = 50; DommagesBonus = 0; ManaBonus = 0; ArmureBonus = 0; ManaRegenBonus = 0; PuissanceBonus = 10; VitesseBonus = 0; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 8; }
public EpeeSolari(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[6]; type = Type.Arme; VieBonus = 100; DommagesBonus = 25; ManaBonus = 50; ArmureBonus = 0; ManaRegenBonus = 0; PuissanceBonus = 25; VitesseBonus = 0; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 5; }
public HelmetPurple(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[10]; type = Type.Casque; VieBonus = 50; DommagesBonus = 0; ManaBonus = 50; ArmureBonus = 1; ManaRegenBonus = 10; PuissanceBonus = 10; VitesseBonus = 0; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 7; }
public GantsDeDevotion(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[9]; type = Type.Gants; VieBonus = 100; DommagesBonus = 10; ManaBonus = 50; ArmureBonus = 0; ManaRegenBonus = 50; PuissanceBonus = 10; VitesseBonus = 0; VieMaxBonus = VieBonus; ManaMaxBonus = ManaBonus; id = 6; }
public void Update(List <Unite> unites) // Appelé quand l'objet est sur la Map { foreach (Unite u in unites) { if (u.isAChamp && Outil.DistancePoints(Position, u.PositionTile) <= 32 && !InInventory) { if (u.Inventory.Count + 1 <= u.InventoryCapacity) { unite = u; u.Inventory.Add(this); InInventory = true; // retire l'objet de la carte et l'ajoute a l'inventaire de l'unité proche Effet(u); } } } }
public bool SpeakToPNJ() // Renvoie si on parle a un PNJ, et modifie l'UI si c'est le cas { // Stoque les PNJ pres du joueurs dans une liste List <Unite> result = Map.unites.Where(i => Outil.DistanceUnites(i, champion) <= 64 && i.isApnj).ToList(); PNJSelected = (result.Count > 0) ? result[0] : null; // prend le premier et le met dans la variable PNJSelected if (PNJSelected != null) // Si on est assez proche du PNJ, on draw le dialogue { Interface.DrawDialogue = Outil.DistancePoints(champion.PositionTile, PNJSelected.PositionTile) <= 46; } else { Interface.DrawDialogue = false; } return(Interface.DrawDialogue); }
protected int TickCurrent; // Tick actuel #endregion Fields #region Constructors public Spell(Unite u, bool useMana = true) { unite = u; AnimationCurrent = AnimationLimite; Cooldown = 1; Ticks = 1; CoutMana = 1; Animation = null; AnimationReset = null; Tiles = Vector2.Zero; NeedUnPoint = false; SpriteBouton = PackTexture.blank; SpriteEffect = PackTexture.blank; sonSort = null; }
public Spell(Unite u, bool useMana = true) { unite = u; AnimationCurrent = AnimationLimite; Cooldown = 1; Ticks = 1; CoutMana = 1; Animation = null; AnimationReset = null; Tiles = Vector2.Zero; NeedUnPoint = false; SpriteBouton = PackTexture.blank; SpriteEffect = PackTexture.blank; sonSort = null; }
public FurieSanguinaire(Unite u, bool useMana = true) : base(u) { idSort = 2; Cooldown = 5; Ticks = 300; if (useMana) CoutMana = 30; else CoutMana = 0; Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[5]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.FurieSanguinaireCible); description = new Text("DescriptionFurieSanguinaire"); }
public Polymorphe(Unite u, bool useMana = true) : base(u) { idSort = 4; Cooldown = 2; Ticks = 1; if (useMana) CoutMana = 30; else CoutMana = 0; NeedUnPoint = false; NeedAUnit = true; SpriteBouton = PackTexture.boutons[12]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.PolymorphCible); description = new Text("DescriptionPolymorph"); }
public Tempete(Unite u, bool useMana = true) : base(u) { idSort = 7; Cooldown = 5; Ticks = 200; CoutMana = 50; Animation = PackAnimation.Explosion(); AnimationReset = PackAnimation.Explosion(); Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[13]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.Explosion); description1 = new Text("DescriptionTempete1"); description2 = new Text("DescriptionTempete2"); }
bool body_OnCollision(Fixture fixtureA, Fixture fixtureB, FarseerPhysics.Dynamics.Contacts.Contact contact) { Unite objet1 = (Unite)(fixtureA.Body.UserData); if (objet1.isAChamp) { if (objet1.ObjectifListe.Count > 0) { Vector2 position = new Vector2((int)(ConvertUnits.ToDisplayUnits(objet1.body.Position.X) / 32), (int)(ConvertUnits.ToDisplayUnits(objet1.body.Position.Y) / 32)); List <Noeud> chemin = PathFinding.TrouverChemin(position, objet1.ObjectifListe[objet1.ObjectifListe.Count - 1].Position, Map.Taille, Map.unites, Map.unitesStatic, false); if (chemin != null) { objet1.ObjectifListe = chemin; } } } return(true); }
public RegenMana(Unite u, bool useMana = true) : base(u) { idSort = 5; Cooldown = 2; Ticks = 1; if (useMana) CoutMana = 500; else CoutMana = 0; Animation = PackAnimation.Soin(); AnimationReset = PackAnimation.Soin(); Tiles = new Vector2(180 / 5, 35); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[2]; SpriteEffect = PackTexture.sorts[2]; sonSort = new EffetSonore(PackSon.Soin); }
public Explosion(Unite u, bool useMana = true) : base(u) { idSort = 1; Cooldown = 2; Ticks = 1; CoutMana = 10; Animation = PackAnimation.Explosion(); AnimationReset = PackAnimation.Explosion(); Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = true; SpriteBouton = PackTexture.boutons[0]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.Explosion); description1 = new Text("DescriptionExplosion1"); description2 = new Text("DescriptionExplosion2"); description3 = new Text("DescriptionExplosion3"); }
public Invisibilite(Unite u, bool useMana = true) : base(u) { idSort = 3; Cooldown = 5; Ticks = 300; if (useMana) CoutMana = 30; else CoutMana = 0; Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[2]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.InvisibiliteCible); uniteFollowing = new List<Unite>(); description1 = new Text("DescriptionInvisibilite1"); description2 = new Text("DescriptionInvisibilite2"); }
public Polymorphe(Unite u, bool useMana = true) : base(u) { idSort = 4; Cooldown = 2; Ticks = 1; if (useMana) { CoutMana = 30; } else { CoutMana = 0; } NeedUnPoint = false; NeedAUnit = true; SpriteBouton = PackTexture.boutons[12]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.PolymorphCible); description = new Text("DescriptionPolymorph"); }
public FurieSanguinaire(Unite u, bool useMana = true) : base(u) { idSort = 2; Cooldown = 5; Ticks = 300; if (useMana) { CoutMana = 30; } else { CoutMana = 0; } Tiles = new Vector2(320 / 5, 320 / 5); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[5]; SpriteEffect = PackTexture.sorts[0]; sonSort = new EffetSonore(PackSon.FurieSanguinaireCible); description = new Text("DescriptionFurieSanguinaire"); }
public Soin(Unite u, bool useMana = true) : base(u) { idSort = 6; Cooldown = 1; Ticks = 1; if (useMana) CoutMana = 15; else CoutMana = 0; Animation = PackAnimation.Soin(); AnimationReset = PackAnimation.Soin(); Tiles = new Vector2(180 / 5, 35); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[1]; SpriteEffect = PackTexture.sorts[1]; sonSort = new EffetSonore(PackSon.Soin); description1 = new Text("DescriptionSoin1"); description2 = new Text("DescriptionSoin2"); }
public void Suivre(Unite unite) { List <Unite> liste = new List <Unite> { }; double distance = Outil.DistanceUnites(this, unite); bool ok = distance > Portee * Map.TailleTiles.X; if (ok) { foreach (Unite u in Map.unites) { if (Outil.DistanceUnites(this, u) <= 1 * Map.TailleTiles.X) { if (u != unite && u != this) { liste.Add(u); } } } suivreactuel = 0; List <Noeud> chemin = PathFinding.TrouverChemin(PositionTile, unite.PositionTile, Map.Taille, liste, Map.unitesStatic, false); if (chemin != null) { ObjectifListe = chemin; ObjectifListe.RemoveAt(0); } else { ObjectifListe.Clear(); body.LinearVelocity = Vector2.Zero; } } else { suivreactuel++; } }
public RegenMana(Unite u, bool useMana = true) : base(u) { idSort = 5; Cooldown = 2; Ticks = 1; if (useMana) { CoutMana = 500; } else { CoutMana = 0; } Animation = PackAnimation.Soin(); AnimationReset = PackAnimation.Soin(); Tiles = new Vector2(180 / 5, 35); NeedUnPoint = false; SpriteBouton = PackTexture.boutons[2]; SpriteEffect = PackTexture.sorts[2]; sonSort = new EffetSonore(PackSon.Soin); }
// Renvoie si on parle a un PNJ, et modifie l'UI si c'est le cas public bool SpeakToPNJ() { // Stoque les PNJ pres du joueurs dans une liste List<Unite> result = Map.unites.Where(i => Outil.DistanceUnites(i, champion) <= 64 && i.isApnj).ToList(); PNJSelected = (result.Count > 0) ? result[0] : null; // prend le premier et le met dans la variable PNJSelected if (PNJSelected != null) // Si on est assez proche du PNJ, on draw le dialogue Interface.DrawDialogue = Outil.DistancePoints(champion.PositionTile, PNJSelected.PositionTile) <= 46; else Interface.DrawDialogue = false; return Interface.DrawDialogue; }
public virtual void Attaquer(Unite unite) { float calcul = Outil.DistanceUnites(this, unite) - (26 * (unite.largeurPhysique + this.largeurPhysique) / 2); if (calcul >= Portee * Map.TailleTiles.X) Suivre(unite); else { if (CanAttack) { if (!uniteAttacked.isInvisible) { OlduniteAttacked = uniteAttacked; ObjectifListe.Clear(); body.LinearVelocity = Vector2.Zero; // Fait regarder l'unité vers l'unité attaqué if (Animation.Count == 0) { FlipH = false; float angle = Outil.AngleUnites(this, unite); if (angle >= Math.PI / 4 && angle <= 3 * Math.PI / 4) direction = Direction.Haut; else if (angle >= -3 * Math.PI / 4 && angle <= -Math.PI / 4) direction = Direction.Bas; else if (angle >= -Math.PI / 4 && angle <= Math.PI / 4) { direction = Direction.Gauche; FlipH = true; } else direction = Direction.Droite; } if (Map.gametime.TotalGameTime.TotalMilliseconds - LastAttack > Vitesse_Attaque * 1000) // Si le cooldown est fini { LastAttack = (float)Map.gametime.TotalGameTime.TotalMilliseconds; // On met à jour "l'heure de la dernière attaque" // projectile if (IsRanged) // Si l'unité attaque à distance, on creer un projectile, sinon on attaque direct Projectile = new Projectile(this, uniteAttacked); else { if (Dommages - unite.Defense <= 0) // Si armure > Dommages , degats = 1 { // On ne prend en compte les degats que si on est en local autrement ils sont effectués via le serveur unite.Vie -= 1; } else { unite.Vie -= Dommages - unite.Defense; } } // son effetUniteAttaque.Play(); // Fait regarder l'unité vers l'unité attaqué et l'anime AnimationCurrent = AnimationLimite; FlipH = false; float angle = Outil.AngleUnites(this, unite); if (angle >= Math.PI / 4 && angle <= 3 * Math.PI / 4) { direction = Direction.Haut; Animation = packAnimation.AttaquerHaut(); } else if (angle >= -3 * Math.PI / 4 && angle <= -Math.PI / 4) { direction = Direction.Bas; Animation = packAnimation.AttaquerBas(); } else if (angle >= -Math.PI / 4 && angle <= Math.PI / 4) { direction = Direction.Gauche; FlipH = true; Animation = packAnimation.AttaquerDroite(); } else { direction = Direction.Droite; Animation = packAnimation.AttaquerDroite(); } } } } } }
// MORT public virtual List<Vector2> Mort(Unite unite) { List<Vector2> liste = new List<Vector2> { }; if(unite is Cavalier) liste.Add(new Vector2(0, 10)); else if (unite is Archer) liste.Add(new Vector2(4, 7)); else if (unite is Troll) liste.Add(new Vector2(4, 9)); else if (unite is Grunt) liste.Add(new Vector2(0, 10)); else if (unite is Demon) liste.Add(new Vector2(0, 10)); else if (unite is Ogre) liste.Add(new Vector2(0, 10)); else if (unite is Guerrier) liste.Add(new Vector2(0, 10)); else if (unite is Odin) liste.Add(new Vector2(3, 0)); else if (unite is Voleur) liste.Add(new Vector2(0, 9)); else if (unite is Chasseur) liste.Add(new Vector2(0, 9)); else throw new Exception("T'as pas modif la classe packanimation!"); return liste; }
public void Cast(Spell s, Vector2 point, Unite unit, bool fromOnline = false) { // Cast ou initialise le sort s.Point = point; s.UniteCible = unit; if(SceneHandler.gameplayScene.isCoopPlay && !fromOnline) isCasting = true; else { spellsUpdate.Add(s); spellsUpdate[spellsUpdate.Count - 1].Begin(point, unit); } }
public void Update(List<Unite> unites) { if (!champion.Mort) { Interface.mouse = Mouse.GetState(); Interface.key = Keyboard.GetState(); // Pour cibler un point pour un sort if (Interface.mouse.LeftButton == ButtonState.Pressed && Interface.Oldmouse.LeftButton == ButtonState.Released && InWaitingPoint) { champion.pointCible = new Vector2((int)((camera.Position.X + Interface.mouse.X) / 32), (int)((camera.Position.Y + Interface.mouse.Y) / 32)); InWaitingPoint = false; Interface.DrawSelectPoint = false; champion.Cast(spell, champion.pointCible, SelectedUnit); } // Pour cibler une unité pour un sort if (Interface.mouse.LeftButton == ButtonState.Pressed && Interface.Oldmouse.LeftButton == ButtonState.Released && InWaitingUnit) { Vector2 point = new Vector2((int)((camera.Position.X + Interface.mouse.X) / 32), (int)((camera.Position.Y + Interface.mouse.Y) / 32)); foreach (Unite u in Map.unites) if (u != champion && !u.isApnj && Outil.DistancePoints(point, u.PositionTile) <= 46) SelectedUnit = u; if (SelectedUnit != null) { champion.Cast(spell, champion.pointCible, SelectedUnit); } InWaitingUnit = false; Interface.DrawSelectUnit = false; } // Pour se déplacer if (Interface.mouse.RightButton == ButtonState.Pressed && !DonnerOrdreAttaquer() && (SourisHoverInventory() && !Interface.DrawSac || !SourisHoverInventory()) && (SourisHoverEquipement() && !Interface.DrawEquipement || !SourisHoverEquipement())) DonnerOrdreDeplacer(); if (!Interface.isWriting) // Si on écrit pas on peut utiliser les raccourcis clavier { // Pour attaquer un point if (Interface.key.IsKeyDown(Keys.A)) DonnerOrdreAttaquerPoint(); // Pour arreter les déplacements if (Interface.key.IsKeyDown(Keys.S)) DonnerOrdreStop(); // Pour se teleporter! if (Interface.key.IsKeyDown(Keys.T) && Interface.Oldkey.IsKeyUp(Keys.T) && CrystalGateGame.isTest) { if (SceneHandler.level == "level1") { FondSonore.PlayBoss(); SceneHandler.ResetGameplay("level4"); } else SceneHandler.ResetGameplay("level1"); } // Pour afficher/cacher le sac if (Interface.key.IsKeyDown(Keys.B) && Interface.Oldkey.IsKeyUp(Keys.B) || Interface.key.IsKeyDown(Keys.I) && Interface.Oldkey.IsKeyUp(Keys.I)) Interface.DrawSac = !Interface.DrawSac; // Pour afficher/cacher le sac if (Interface.key.IsKeyDown(Keys.C) && Interface.Oldkey.IsKeyUp(Keys.C)) Interface.DrawEquipement = !Interface.DrawEquipement; } // Pour lancer un sort if (Interface.key.IsKeyDown(Keys.D1) && Interface.Oldkey.IsKeyUp(Keys.D1) && champion.spells.Count > 0 || Interface.SourisClickSpellCheck(0) && champion.spells.Count > 0) { spell = champion.spells[0]; if (champion.IsCastable(0)) { if (champion.spells[0].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D2) && Interface.Oldkey.IsKeyUp(Keys.D2) && champion.spells.Count > 1 || Interface.SourisClickSpellCheck(1) && champion.spells.Count > 1) { spell = champion.spells[1]; if (champion.IsCastable(1)) { if (champion.spells[1].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D3) && Interface.Oldkey.IsKeyUp(Keys.D3) && champion.spells.Count > 2 || Interface.SourisClickSpellCheck(2) && champion.spells.Count > 2) { spell = champion.spells[2]; if (champion.IsCastable(2)) { if (champion.spells[2].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D4) && Interface.Oldkey.IsKeyUp(Keys.D4) && champion.spells.Count > 3 || Interface.SourisClickSpellCheck(3) && champion.spells.Count > 3) { spell = champion.spells[3]; if (champion.IsCastable(3)) { if (champion.spells[3].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D5) && Interface.Oldkey.IsKeyUp(Keys.D5) && champion.spells.Count > 4 || Interface.SourisClickSpellCheck(4) && champion.spells.Count > 4) { spell = champion.spells[4]; if (champion.IsCastable(4)) { if (champion.spells[4].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } if (champion.spells[4].NeedAUnit) { Interface.DrawSelectUnit = true; InWaitingUnit = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D6) && Interface.Oldkey.IsKeyUp(Keys.D6) && champion.spells.Count > 5 || Interface.SourisClickSpellCheck(5) && champion.spells.Count > 5) { spell = champion.spells[5]; if (champion.IsCastable(5)) { if (champion.spells[5].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } if (champion.spells[5].NeedAUnit) { Interface.DrawSelectUnit = true; InWaitingUnit = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } } // Pour verifier si on parle a un pnj SpeakToPNJ(); // Pour déplacer la caméra CameraUpdate(); Interface.Update(); UpdateReseau(); CurseurCheck(); Interface.Oldmouse = Interface.mouse; Interface.Oldkey = Interface.key; }
public void Suivre(Unite unite) { List<Unite> liste = new List<Unite> { }; double distance = Outil.DistanceUnites(this, unite); bool ok = distance > Portee * Map.TailleTiles.X; if (ok) { foreach (Unite u in Map.unites) if (Outil.DistanceUnites(this, u) <= 1 * Map.TailleTiles.X) { if (u != unite && u != this) liste.Add(u); } suivreactuel = 0; List<Noeud> chemin = PathFinding.TrouverChemin(PositionTile, unite.PositionTile, Map.Taille, liste, Map.unitesStatic, false); if (chemin != null) { ObjectifListe = chemin; ObjectifListe.RemoveAt(0); } else { ObjectifListe.Clear(); body.LinearVelocity = Vector2.Zero; } } else suivreactuel++; }
public virtual void Begin(Vector2 p, Unite unit) { LastCast = (float)Map.gametime.TotalGameTime.TotalMilliseconds; Activated = true; TickCurrent = 0; if(sonSort != null) sonSort.Play(); unite.Mana -= CoutMana; Point = p; UniteCible = unit; }
public override void Effet(Unite unite) { spell = new RegenMana(unite, false); }
public override void Effet(Unite unite) { spell = new Soin(unite, false); }
public void Update(List <Unite> unites) { if (!champion.Mort) { Interface.mouse = Mouse.GetState(); Interface.key = Keyboard.GetState(); // Pour cibler un point pour un sort if (Interface.mouse.LeftButton == ButtonState.Pressed && Interface.Oldmouse.LeftButton == ButtonState.Released && InWaitingPoint) { champion.pointCible = new Vector2((int)((camera.Position.X + Interface.mouse.X) / 32), (int)((camera.Position.Y + Interface.mouse.Y) / 32)); InWaitingPoint = false; Interface.DrawSelectPoint = false; champion.Cast(spell, champion.pointCible, SelectedUnit); } // Pour cibler une unité pour un sort if (Interface.mouse.LeftButton == ButtonState.Pressed && Interface.Oldmouse.LeftButton == ButtonState.Released && InWaitingUnit) { Vector2 point = new Vector2((int)((camera.Position.X + Interface.mouse.X) / 32), (int)((camera.Position.Y + Interface.mouse.Y) / 32)); foreach (Unite u in Map.unites) { if (u != champion && !u.isApnj && Outil.DistancePoints(point, u.PositionTile) <= 46) { SelectedUnit = u; } } if (SelectedUnit != null) { champion.Cast(spell, champion.pointCible, SelectedUnit); } InWaitingUnit = false; Interface.DrawSelectUnit = false; } // Pour se déplacer if (Interface.mouse.RightButton == ButtonState.Pressed && !DonnerOrdreAttaquer() && (SourisHoverInventory() && !Interface.DrawSac || !SourisHoverInventory()) && (SourisHoverEquipement() && !Interface.DrawEquipement || !SourisHoverEquipement())) { DonnerOrdreDeplacer(); } if (!Interface.isWriting) // Si on écrit pas on peut utiliser les raccourcis clavier { // Pour attaquer un point if (Interface.key.IsKeyDown(Keys.A)) { DonnerOrdreAttaquerPoint(); } // Pour arreter les déplacements if (Interface.key.IsKeyDown(Keys.S)) { DonnerOrdreStop(); } // Pour se teleporter! if (Interface.key.IsKeyDown(Keys.T) && Interface.Oldkey.IsKeyUp(Keys.T) && CrystalGateGame.isTest) { if (SceneHandler.level == "level1") { FondSonore.PlayBoss(); SceneHandler.ResetGameplay("level4"); } else { SceneHandler.ResetGameplay("level1"); } } // Pour afficher/cacher le sac if (Interface.key.IsKeyDown(Keys.B) && Interface.Oldkey.IsKeyUp(Keys.B) || Interface.key.IsKeyDown(Keys.I) && Interface.Oldkey.IsKeyUp(Keys.I)) { Interface.DrawSac = !Interface.DrawSac; } // Pour afficher/cacher le sac if (Interface.key.IsKeyDown(Keys.C) && Interface.Oldkey.IsKeyUp(Keys.C)) { Interface.DrawEquipement = !Interface.DrawEquipement; } } // Pour lancer un sort if (Interface.key.IsKeyDown(Keys.D1) && Interface.Oldkey.IsKeyUp(Keys.D1) && champion.spells.Count > 0 || Interface.SourisClickSpellCheck(0) && champion.spells.Count > 0) { spell = champion.spells[0]; if (champion.IsCastable(0)) { if (champion.spells[0].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D2) && Interface.Oldkey.IsKeyUp(Keys.D2) && champion.spells.Count > 1 || Interface.SourisClickSpellCheck(1) && champion.spells.Count > 1) { spell = champion.spells[1]; if (champion.IsCastable(1)) { if (champion.spells[1].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D3) && Interface.Oldkey.IsKeyUp(Keys.D3) && champion.spells.Count > 2 || Interface.SourisClickSpellCheck(2) && champion.spells.Count > 2) { spell = champion.spells[2]; if (champion.IsCastable(2)) { if (champion.spells[2].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D4) && Interface.Oldkey.IsKeyUp(Keys.D4) && champion.spells.Count > 3 || Interface.SourisClickSpellCheck(3) && champion.spells.Count > 3) { spell = champion.spells[3]; if (champion.IsCastable(3)) { if (champion.spells[3].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D5) && Interface.Oldkey.IsKeyUp(Keys.D5) && champion.spells.Count > 4 || Interface.SourisClickSpellCheck(4) && champion.spells.Count > 4) { spell = champion.spells[4]; if (champion.IsCastable(4)) { if (champion.spells[4].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } if (champion.spells[4].NeedAUnit) { Interface.DrawSelectUnit = true; InWaitingUnit = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } if (Interface.key.IsKeyDown(Keys.D6) && Interface.Oldkey.IsKeyUp(Keys.D6) && champion.spells.Count > 5 || Interface.SourisClickSpellCheck(5) && champion.spells.Count > 5) { spell = champion.spells[5]; if (champion.IsCastable(5)) { if (champion.spells[5].NeedUnPoint) { Interface.DrawSelectPoint = true; InWaitingPoint = true; } if (champion.spells[5].NeedAUnit) { Interface.DrawSelectUnit = true; InWaitingUnit = true; } else { champion.Cast(spell, champion.pointCible, SelectedUnit); } } } } // Pour verifier si on parle a un pnj SpeakToPNJ(); // Pour déplacer la caméra CameraUpdate(); Interface.Update(); UpdateReseau(); CurseurCheck(); Interface.Oldmouse = Interface.mouse; Interface.Oldkey = Interface.key; }
public Stuff(Unite unite, Vector2 position) : base(unite, position) { Icone = PackTexture.boutons[0]; }