public virtual void Update(GameTime gameTime) { if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsLeftClicked()) { OnMouseClick(new MouseClickEventArgs(0, MouseManager.Position)); } }
public virtual void Update(GameTime gameTime) { if (MouseManager.IsInRectangle(Bounds) && MouseManager.IsLeftClicked()) { OnMouseClick(new MouseClickEventArgs(0, MouseManager.Position)); } if (MouseManager.IsClicking() && MouseManager.Position.Y <= Bounds.Bottom && MouseManager.Position.Y >= Bounds.Y) { OnSlideAxeX(new MouseClickEventArgs(0, MouseManager.Position)); } }
public override void Update(GameTime gameTime) { if (CanMove) { base.Update(gameTime); InternalMove(gameTime); } coord = new Vector2((int)Math.Ceiling(Position.X * 32 / 1000) - 1, (int)Math.Ceiling(Position.Y * 32 / 1000) - 1); // Pour le lancement de spells for (int i = 0; i < spells.Count; i++) { if (!KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Spell1 + i]) && !(MouseManager.IsInRectangle(spellsRect[i]) && MouseManager.IsLeftClicked())) { continue; } if (spells[i].Type == SpellType.Buff) { if (spells[i].IsActivated) { spells[i].Unbuff(); } else { spells[i].Buff(); } } else { spells[i].Cast(); } } // Change de cible if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target]) || MouseManager.IsLeftClicked()) { if (Target != null) { Target.Targeter = null; } if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Target])) { IList <Monster> monsters = Game.Entities.OfType <Monster>().ToList(); ++targetIndex; if (targetIndex >= monsters.Count) { targetIndex = (monsters.Count > 0 ? 0 : -1); } Target = targetIndex >= 0 ? monsters[targetIndex] : null; } else { foreach (Monster monster in Game.Entities.OfType <Monster>()) { if (MouseManager.IsInRectangle(GameScreen.Camera.ScreenLocation(MouseManager.Position), monster.Bounds)) { Target = monster; } } } if (Target != null) { Target.Targeter = this; } } // Deselectionne une cible if (KeyboardManager.IsPressed(KeyboardManager.BindedKeys[(int)KeyboardManager.KeysEnum.Escape])) { if (Target != null) { Target.Targeter = null; } Target = null; } // Insérer tout le cheat if (Keyboard.GetState().IsKeyDown(Keys.D0)) { Power = Stats.PowerMax; } // Update tout les spells foreach (Spell spell in spells) { spell.Update(gameTime); } Regeneration(gameTime); }
public override void Update(GameTime gameTime) { if (CanMove) { Vector2 oldPos = Position; base.Update(gameTime); InternalMove(gameTime); if (MouseManager.IsRightClicked()) //Deplacement a la souris { pos = GameScreen.camera.Location(MouseManager.Position); } if (pos.X > 0 && pos.Y > 0) { new Maps.Path.Ia(gameTime, pos, this, this.Game.MapFirst.Data); } if (oldPos == Position) { Step = 1; } } coord = new Vector2((int)Math.Ceiling(Position.X * 32 / 1000) - 1, (int)Math.Ceiling(Position.Y * 32 / 1000) - 1); Keys[] keys = new[] { Keys.Q, Keys.A, Keys.E, Keys.R, Keys.D2 }; for (int i = 0; i < spells.Count; i++) { if (keys.Length < i) { break; } if (!KeyboardManager.IsPressed(keys[i]) && !(MouseManager.IsInRectangle(spellsRect[i]) && MouseManager.IsLeftClicked())) { continue; } if (spells[i].Type == SpellType.Buff) // Si le sort est un Buff... { if (spells[i].IsActivated) { spells[i].Unbuff(); } else { spells[i].Buff(); } } else { spells[i].Cast(); } } if (KeyboardManager.IsPressed(Keys.Tab) || MouseManager.IsLeftClicked()) // Change de cible { if (Target != null) { Target.Targeter = null; } if (KeyboardManager.IsPressed(Keys.Tab)) { IList <Monster> monsters = Game.Entities.OfType <Monster>().ToList(); ++targetIndex; if (targetIndex >= monsters.Count) { targetIndex = (monsters.Count > 0 ? 0 : -1); } Target = targetIndex >= 0 ? monsters[targetIndex] : null; } else { foreach (Monster monster in Game.Entities.OfType <Monster>()) { if (MouseManager.IsInRectangle(monster.Bounds, GameScreen.camera)) { Target = monster; } } } if (Target != null) { Target.Targeter = this; } } if (KeyboardManager.IsPressed(Keys.Escape)) // Deselectionne une cible { if (Target != null) { Target.Targeter = null; } Target = null; } // Insérer tout le cheat if (Keyboard.GetState().IsKeyDown(Keys.D1)) { Power = Stats.PowerMax; } // Insérer tout le cheat foreach (Spell spell in spells) // Update tout les spells { spell.Update(gameTime); } Regeneration(gameTime); }