public override void HandleInput(KeyboardState newKeyboardState, MouseState new_mouseState, Game1 parent) { if (_windowSize != parent.Window.ClientBounds) { _windowSize = parent.Window.ClientBounds; WindowResized(parent.Window.ClientBounds); } if (new_mouseState != _mouseState) _mouse.Position = new Rectangle(new_mouseState.X, new_mouseState.Y, _mouse.Position.Width, _mouse.Position.Height); if (newKeyboardState.IsKeyDown(Keys.Escape) && !_keyboardState.IsKeyDown(Keys.Escape)) parent.SwitchScene(Scene.MainMenu); if (new_mouseState.LeftButton == ButtonState.Pressed) { Rectangle click = new Rectangle(new_mouseState.X, new_mouseState.Y, 1, 1); if (_soundEffect.Position.Intersects(click)) _volumeEffect = (float)(click.X - _soundEffect.Position.X) / (float)_soundEffect.Position.Width; if (_soundMusic.Position.Intersects(click)) _volumeMusic = (float)(click.X - _soundMusic.Position.X) / (float)_soundMusic.Position.Width; parent.son.MusiquesVolume = _volumeMusic; parent.son.SonsVolume = _volumeEffect; EugLib.IO.FileStream.writeFile(SOUND_FILENAME, _volumeMusic + " " + _volumeEffect); } _keyboardState = newKeyboardState; _mouseState = new_mouseState; }
public override void Activation(Game1 parent) { mousestate = Mouse.GetState(); sprites.Clear(); mouse.EmitterLocation = new DecimalRectangle(-100, -100, 0, 0); parent.son.Play(Musiques.MenuMusic); }
public override void Activation(Game1 parent) { mousestate = Mouse.GetState(); sprites.Clear(); mouse.Position = new Rectangle(-100, -100, mouse.Position.Width, mouse.Position.Height); parent.son.Play(Musiques.MenuMusic); }
static void Main(string[] args) { using (Game1 game = new Game1()) // Pour s'assurer que tout le contenu sera libéré à la fin de léxecution { game.Run(); } }
public override void Activation(Game1 parent = null) { if (this._video != null) this._player.Play(this._video); if (parent != null) this._windowSize = new Rectangle(0, 0, parent.Window.ClientBounds.Width, parent.Window.ClientBounds.Height); this._timer = 400; }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (this._timer < 0 && (newKeyboardState.IsKeyDown(Keys.Space) || this._player.State != MediaState.Playing)) { this._player.Stop(); parent.SwitchScene(this._next); } this._windowSize = new Rectangle(0, 0, parent.Window.ClientBounds.Width, parent.Window.ClientBounds.Height); }
public override void Activation(Game1 parent) { foreach (AnimatedSprite s in animations) s.ActualPicture = 1; Rectangle r = animations.ElementAt<AnimatedSprite>(2).Position; r.Y = _windowSize.Height; animations.ElementAt<AnimatedSprite>(2).Position = r; parent.son.Play(Musiques.CreditMusic); }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (_timer < 0) if (newKeyboardState.GetPressedKeys().Length > 0 || _player.State != MediaState.Playing) { _player.Stop(); parent.SwitchScene(_next); } _windowSize = new Rectangle(0, 0, parent.Window.ClientBounds.Width, parent.Window.ClientBounds.Height); }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != _windowSize) { _windowSize = parent.Window.ClientBounds; windowResized(_windowSize); } if (newKeyboardState.IsKeyDown(Keys.Escape) && !_keyboardState.IsKeyDown(Keys.Escape)) parent.SwitchScene(Scene.MainMenu); _keyboardState = newKeyboardState; }
public override void Activation(Game1 parent) { for (int i = 0; i < animations.Count; i++) { try { ((AnimatedSprite)animations[i]).ActualPicture = 1; } catch (Exception) { } } Game1.son.Play(Musiques.CreditMusic); }
public override void Activation(Game1 parent = null) { Start(); _keyboardState = Keyboard.GetState(); Game1.son.Play(_music); foreach (int i in _textToShow) { try { ((TextSprite)animation[i].Image).StartShowing(); } catch (Exception) { } } }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != _windowSize) { _windowSize = parent.Window.ClientBounds; WindowResized(_windowSize); } if (!_keyboardstate.IsKeyDown(Keys.Space) && newKeyboardState.IsKeyDown(Keys.Space)) parent.SwitchScene(Scene.MainMenu); if (!_keyboardstate.IsKeyDown(Keys.Escape) && newKeyboardState.IsKeyDown(Keys.Escape)) parent.Exit(); if (!_keyboardstate.IsKeyDown(Keys.H) && newKeyboardState.IsKeyDown(Keys.H)) parent.SwitchScene(Scene.IntroHistoire); if (!_keyboardstate.IsKeyDown(Keys.V) && newKeyboardState.IsKeyDown(Keys.V)) parent.SwitchScene(Scene.IntroVid); _keyboardstate = newKeyboardState; _mouseState = newMouseState; }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != _windowSize) { _windowSize = parent.Window.ClientBounds; windowResized(parent.Window.ClientBounds); } if (!newKeyboardState.IsKeyDown(Keys.Escape) && _keyboardState.IsKeyDown(Keys.Escape)) parent.SwitchScene(Scene.MainMenu); bool isClick = false; if (_mouseState != newMouseState) { mouse.Position = new Rectangle(newMouseState.X, newMouseState.Y, mouse.Position.Width, mouse.Position.Height); isClick = newMouseState.LeftButton == ButtonState.Pressed && _mouseState.LeftButton == ButtonState.Released; } if (newKeyboardState.IsKeyDown(Keys.Right)) map.Moving(new Vector2(_speedPerso, 0), true); if (newKeyboardState.IsKeyDown(Keys.Left)) map.Moving(new Vector2(-_speedPerso, 0), true); if (newKeyboardState.IsKeyDown(Keys.Up)) map.Moving(new Vector2(0, -_speedPerso), true); if (newKeyboardState.IsKeyDown(Keys.Down)) map.Moving(new Vector2(0, _speedPerso), true); //perso if (_keyboardState != newKeyboardState) { if (newKeyboardState.IsKeyDown(Keys.Space)) personnage.JumpR(18); if (newKeyboardState.IsKeyDown(Keys.Right) && !newKeyboardState.IsKeyDown(Keys.Space)) personnage.RunR(18); if (newKeyboardState.IsKeyDown(Keys.Left) && !newKeyboardState.IsKeyDown(Keys.Space)) personnage.RunL(18); if (!newKeyboardState.IsKeyDown(Keys.Space) && !newKeyboardState.IsKeyDown(Keys.Left) && !newKeyboardState.IsKeyDown(Keys.Right)) personnage.Stop(3); } _keyboardState = newKeyboardState; _mouseState = newMouseState; }
public override void EndScene(Game1 parent) { parent.son.Stop(); }
public override void EndScene(Game1 parent) { _windowSize = parent.Window.ClientBounds; /*map.VuePosition = new Vector2(460, 450 + 130 - 1); map.Elements[0].sprite.setRelatvePos(new Rectangle(0, 0, 1040, 320), _originalWindowSize.Width, _originalWindowSize.Height); map.Elements[1].sprite.setRelatvePos(new Rectangle(0, 190, 960, 300), _originalWindowSize.Width, _originalWindowSize.Height); map.Elements[2].sprite.setRelatvePos(new Rectangle(0, 415, 1082, 193), _originalWindowSize.Width, _originalWindowSize.Height); map.Elements[3].sprite.setRelatvePos(new Rectangle(0, 515, 1066, 92), _originalWindowSize.Width, _originalWindowSize.Height); map.Elements[4].sprite.setRelatvePos(new Rectangle(5, 150, _windowSize.Width / 2, _windowSize.Height - 150), _originalWindowSize.Width, _originalWindowSize.Height); map.Elements[5].sprite.setRelatvePos(new Rectangle(2800 + _windowSize.Width / 2, 150, _windowSize.Width / 2 - 20, _windowSize.Height - 150), _originalWindowSize.Width, _originalWindowSize.Height); map.WindowResized(_windowSize);*/ foreach (AbstractMap m in _maps) { m.Activation(); m.WindowResized(_windowSize); } _currentMap = 0; rand = new Random(); foreach (List<Mob> l in _mobs) l.Clear(); foreach (List<Mob> l in _mobs) for (int i = 0; i < 50; i++) l.Add(new Mob(_windowSize, rand.Next(), new Vector2(1000, 580), 100, 200, "game/blitz", 5, 4, new Vector2(3f, 3f), new Vector2(1f, 0.5f), 300, 50, new Rectangle(900, 485, 2000, 100))); foreach (List<Mob> l in _mobs) foreach (Mob m in l) { m.AddGraphicalBounds(CharacterActions.WalkRight, new Rectangle(6, 6, 10, 30)); m.AddGraphicalBounds(CharacterActions.WalkLeft, new Rectangle(1, 1, 5, 30)); m.AddGraphicalBounds(CharacterActions.StandLeft, new Rectangle(3, 3, 3, 30)); m.AddGraphicalBounds(CharacterActions.StandRight, new Rectangle(8, 8, 8, 30)); m.AddGraphicalBounds(CharacterActions.Attack1Left, new Rectangle(11, 11, 12, 4)); m.AddGraphicalBounds(CharacterActions.Attack1Right, new Rectangle(16, 16, 17, 4)); m.AddGraphicalBounds(CharacterActions.ReceiveAttackLeft, new Rectangle(13, 13, 13, 4)); m.AddGraphicalBounds(CharacterActions.ReceiveAttackRight, new Rectangle(18, 18, 18, 4)); } foreach (List<Mob> l in _mobs) foreach (Mob m in l) { m.LoadContent(parent.Content); m.WindowResized(_windowSize); } personnage.Life = 1; personnage.Mana = 1; personnage.Experience.Reset(); }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (_visible) { if (newMouseState != _mouseState) { Rectangle click = new Rectangle(newMouseState.X, newMouseState.Y, 1, 1); if (newMouseState.LeftButton == ButtonState.Pressed && _mouseState.LeftButton == ButtonState.Released) { _choise = ContextMenu.NONE; if (_exit != null && click.Intersects(_exit.Position)) { _visible = false; _choise = ContextMenu.HIDE_MENU; } foreach (AnimatedSprite s in _elements) { if (click.Intersects(s.Position)) _choise = _elements.IndexOf(s); } if (click.Intersects(_title.Position)) _isMoving = true; else _isMoving = false; } else if (newMouseState.LeftButton == ButtonState.Pressed && _mouseState.LeftButton == ButtonState.Pressed) { if (_isMoving) MoveBy(newMouseState.X - _mouseState.X, newMouseState.Y - _mouseState.Y); } else _isMoving = false; _mouseState = newMouseState; } } }
public override void Activation(Game1 parent) { _visible = false; _choise = ContextMenu.NONE; }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { Rectangle newWindowSize = parent.Window.ClientBounds; if (newWindowSize.Width != windowWidth || newWindowSize.Height != windowHeight) windowResized(newWindowSize); if (parent.IsActive) { if (newKeyboardState.IsKeyDown(Keys.Escape) && !keyboardState.IsKeyDown(Keys.Escape)) { if (selection == Selection.Exit) parent.SwitchScene(Scene.Titre); else { selection = Selection.Exit; parent.son.Play(Sons.MenuSelection); } } if (newKeyboardState.IsKeyDown(Keys.Right) && !keyboardState.IsKeyDown(Keys.Right)) { selection++; parent.son.Play(Sons.MenuSelection); } if (newKeyboardState.IsKeyDown(Keys.Left) && !keyboardState.IsKeyDown(Keys.Left)) { selection--; parent.son.Play(Sons.MenuSelection); } if (newKeyboardState.IsKeyDown(Keys.Up) && !keyboardState.IsKeyDown(Keys.Up)) { selection--; parent.son.Play(Sons.MenuSelection); } if (newKeyboardState.IsKeyDown(Keys.Down) && !keyboardState.IsKeyDown(Keys.Down)) { selection++; parent.son.Play(Sons.MenuSelection); } if ((int)selection >= menuItems.Count) selection = (Selection)0; else if ((int)selection < 0) selection = (Selection)(menuItems.Count - 1); if (newKeyboardState.IsKeyDown(Keys.Enter) && !keyboardState.IsKeyDown(Keys.Enter)) { selectionEvent(parent); } if (mousestate != newMouseState) { bool isClicked = newMouseState.LeftButton == ButtonState.Pressed && mousestate.LeftButton == ButtonState.Released; mouse.EmitterLocation = new DecimalRectangle(newMouseState.X, newMouseState.Y,0,0); int i = 0; foreach (Sprite st in menuItems.Values) { if (st.Position.Intersects(new Rectangle((int)mouse.EmitterLocation.X, (int)mouse.EmitterLocation.Y, 1, 1))) { if ((int)selection != i) parent.son.Play(Sons.MenuSelection); selection = (Selection)i; if (isClicked) selectionEvent(parent); } i++; } if (isClicked) { sprites.Add(new AnimatedSprite(new Rectangle(newMouseState.X - windowWidth / 3 / 2, newMouseState.Y - windowHeight / 3 / 2, windowWidth / 3, windowHeight / 3), newWindowSize, 8, 5, 35)); sprites.Last<AnimatedSprite>().LoadContent(cursorClic); } } keyboardState = newKeyboardState; mousestate = newMouseState; } }
/// <summary> /// Gestion de l'evenement de selection /// </summary> /// <param name="parent">Reference de la classe Game1 parent</param> private void selectionEvent(Game1 parent) { parent.son.Play(Sons.MenuSelection); switch (selection) { case Selection.Exit: parent.Exit(); break; case Selection.Play: parent.SwitchScene(Scene.InGame); break; case Selection.Extra: parent.SwitchScene(Scene.Extra); break; case Selection.Credit: parent.SwitchScene(Scene.Credit); break; case Selection.Options: parent.SwitchScene(Scene.Options); break; } }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (!this._canMove) return; if (!this._jumping) { if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.WalkRight))) this.Move(true); else if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.WalkLeft))) this.Move(false); else if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.WalkUp))) this.Move(this._direction); else if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.WalkDown))) this.Move(this._direction); else this.Stand(this._direction); if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.Jump))) { this.Jump(); Game1.son.Play(Sons.Jump); } } if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.Attack1))) { this.Action = this._direction ? CharacterActions.Attack1Right : CharacterActions.Attack1Left; this.Attack(this.Action); if (this.Attacks.ContainsKey(this.Action)) this._timer = this.Attacks[this.Action].AttackTime; this.actualizeSpriteGraphicalBounds(); } if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.AttackStun))) { this._canMove = false; this.Action = this._direction ? CharacterActions.AttackStunRight : CharacterActions.AttackStunLeft; if (this.Attacks.ContainsKey(this.Action)) this._timer = this.Attacks[this.Action].AttackTime; this.Attack(this.Action); this.actualizeSpriteGraphicalBounds(); } if (newKeyboardState.IsKeyDown(this._inputManager.Get(Personnage.KeysActions.Attack2))) { this._canMove = false; this.Action = this._direction ? CharacterActions.Attack2Right : CharacterActions.Attack2Left; if (this.Attacks.ContainsKey(this.Action)) this._timer = this.Attacks[this.Action].AttackTime; this.Attack(this.Action); this.actualizeSpriteGraphicalBounds(); } }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != this._windowSize) this.windowResized(parent.Window.ClientBounds); if (!newKeyboardState.IsKeyDown(Keys.Escape) && this._keyboardState.IsKeyDown(Keys.Escape)) this._menu.Visible = !this._menu.Visible; bool flag = false; if (this._mouseState != newMouseState) { this.mouse.Position = new Rectangle(newMouseState.X, newMouseState.Y, this.mouse.Position.Width, this.mouse.Position.Height); flag = newMouseState.LeftButton == ButtonState.Pressed && this._mouseState.LeftButton == ButtonState.Released; } this._menu.HandleInput(newKeyboardState, newMouseState, parent); if (this._menu.Choise == 0) parent.SwitchScene(Scene.MainMenu); else if (this._menu.Choise == 1) StartServer(); else if (this._menu.Choise == 2) Connection(); else if (this._menu.Choise == 3) StopAllConnections(); _menu.Choise = ContextMenu.NONE; int num; if ((num = this._hud.SelectedWeapon(this._mouseState)) >= 0) this.personnage.Weapon = num; float move = (float)_windowSize.Width * 0.005555556f; if (newKeyboardState.IsKeyDown(Keys.Right) && this.personnage._canMove && this._maps[this._currentMap].Moving(new Vector2(move * (_dashing ? DashSpeed : 1f), 0.0f), true)) { foreach (Mob mob in this._mobs[this._currentMap]) mob.Move((int)((float)move * (_dashing ? DashSpeed : 1f)), 0); foreach (Attack attack in this.personnage.Attacks.Values) attack.Move((int)((float)move * (_dashing ? DashSpeed : 1f)), 0); } if (newKeyboardState.IsKeyDown(Keys.Left) && this.personnage._canMove && this._maps[this._currentMap].Moving(new Vector2(-move * (_dashing ? DashSpeed : 1f), 0.0f), true)) { foreach (Mob mob in this._mobs[this._currentMap]) mob.Move(-(int)((float)move * (_dashing ? DashSpeed : 1f)), 0); foreach (Attack attack in this.personnage.Attacks.Values) attack.Move(-(int)((float)move * (_dashing ? DashSpeed : 1f)), 0); } // DASH if (newKeyboardState.IsKeyDown(Keys.Right) && _keyboardState.IsKeyUp(Keys.Right) || newKeyboardState.IsKeyDown(Keys.Left) && _keyboardState.IsKeyUp(Keys.Left)) { if (_waitingDash && _dashTimer < DashKeyDelay) { _dashing = true; } else if (!_waitingDash) { _waitingDash = true; } else _waitingDash = false; _dashTimer = 0; } if (newKeyboardState.IsKeyDown(Keys.Up) && this.personnage._canMove && this._maps[this._currentMap].Moving(new Vector2(0.0f, -move), true)) { foreach (Mob mob in this._mobs[this._currentMap]) mob.Move(0, -(int)move); foreach (Attack attack in this.personnage.Attacks.Values) attack.Move(0, -(int)(0.4f * move)); } if (newKeyboardState.IsKeyDown(Keys.Down) && this.personnage._canMove && this._maps[this._currentMap].Moving(new Vector2(0.0f, move), true)) { foreach (Mob mob in this._mobs[this._currentMap]) mob.Move(0, (int)move); foreach (Attack attack in this.personnage.Attacks.Values) attack.Move(0, (int)(0.4f * move)); } this.personnage.HandleInput(newKeyboardState, newMouseState, parent); this._hud.HandleInput(newKeyboardState, newMouseState, parent); if ((double)this.personnage.Life <= 0.0) { parent.SwitchScene(Scene.GameOver); _animDone = false; } if (newKeyboardState.IsKeyDown(Keys.E) && this._keyboardState.IsKeyUp(Keys.E)) { int map = _currentMap; if (_mobs[_currentMap].Count <= 0) this._currentMap += this._maps[this._currentMap].GetTravelState(this.personnage.DrawingRectangle); if (this._currentMap < 0) this._currentMap = 0; if (map != _currentMap) { _animDone = false; parent.SwitchScene(Scene.InGame); } } this._keyboardState = newKeyboardState; this._mouseState = newMouseState; }
/// <summary> /// Fonction a appeler avant d'utiliser la scene /// </summary> /// <param name="parent">Reference de la classe parent</param> public virtual void Activation(Game1 parent = null) { }
public override void EndScene(Game1 parent) { }
/// <summary> /// Gere les entrees de clavier, souris et evenements /// </summary> /// <param name="newKeyboardState">Nouvel etat du clavier</param> /// <param name="newMouseState">Nouvel etat de la souris</param> /// <param name="parent">Reference de la classe parent</param> public virtual void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { }
/// <summary> /// Fonction a appeler avant de changer de scene /// </summary> /// <param name="parent">Reference de la classe parent</param> public virtual void EndScene(Game1 parent = null) { }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != _windowSize) { windowResized(parent.Window.ClientBounds); } if (!newKeyboardState.IsKeyDown(Keys.Escape) && _keyboardState.IsKeyDown(Keys.Escape)) _menu.Visible = !_menu.Visible; bool isClick = false; if (_mouseState != newMouseState) { mouse.Position = new Rectangle(newMouseState.X, newMouseState.Y, mouse.Position.Width, mouse.Position.Height); isClick = newMouseState.LeftButton == ButtonState.Pressed && _mouseState.LeftButton == ButtonState.Released; } _menu.HandleInput(newKeyboardState, newMouseState, parent); if (_menu.Choise == 0) parent.SwitchScene(Scene.MainMenu); //// MOUVEMENT //// if (newKeyboardState.IsKeyDown(Keys.Right) && personnage._canMove) { if (_maps[_currentMap].Moving(new Vector2(5, 0), true)) foreach (Mob m in _mobs[_currentMap]) m.Move(5, 0); } if (newKeyboardState.IsKeyDown(Keys.Left) && personnage._canMove) { if (_maps[_currentMap].Moving(new Vector2(-5, 0), true)) foreach (Mob m in _mobs[_currentMap]) m.Move(-5, 0); } if (newKeyboardState.IsKeyDown(Keys.Up) && personnage._canMove) { if (_maps[_currentMap].Moving(new Vector2(0, -5), true)) foreach (Mob m in _mobs[_currentMap]) m.Move(0, -5); } if (newKeyboardState.IsKeyDown(Keys.Down) && personnage._canMove) { if (_maps[_currentMap].Moving(new Vector2(0, 5), true)) foreach (Mob m in _mobs[_currentMap]) m.Move(0, 5); } if (newKeyboardState.IsKeyDown(Keys.E) && _keyboardState.IsKeyUp(Keys.E)) { _currentMap += _maps[_currentMap].GetTravelState(personnage.DrawingRectangle); if (_currentMap < 0) _currentMap = 0; else if (_currentMap >= _maps.Count) _currentMap = _maps.Count - 1; } personnage.HandleInput(newKeyboardState, newMouseState, parent); _hud.HandleInput(newKeyboardState, newMouseState, parent); if (personnage.Life <= 0) parent.SwitchScene(Scene.MainMenu); _keyboardState = newKeyboardState; _mouseState = newMouseState; }
public override void Activation(Game1 parent) { _mouseState = Mouse.GetState(); _keyboardState = Keyboard.GetState(); _menu.Activation(parent); }
public override void Activation(Game1 parent) { Game1.son.Play(Musiques.Jeu); if (!_animDone) { _animDone = true; switch (_currentMap) { case 0: parent.SwitchScene(Scene.IntroLateX);//Combat contre toutes les créatures de LateX(map verte) break; case 1: parent.SwitchScene(Scene.LateXEradicated);//combat contre l'armée du roi de LateX(map chateau) break; case 2: parent.SwitchScene(Scene.BeforeKingFight);//combat contre roi de LateX (armée éradiquée)(re map chateau) break; case 3: parent.SwitchScene(Scene.AfterKingFight);//retour sur OpenEdge + combat armée(map dark) break; case 4: parent.SwitchScene(Scene.LastFight);//combat contre Spark(re map dark sauf si on a le temps d'en faire une autre) break; case 5: _currentMap = 0; parent.SwitchScene(Scene.Credit); break; } } this._mouseState = Mouse.GetState(); this._keyboardState = Keyboard.GetState(); this._menu.Activation(parent); Load(); }
public override void HandleInput(KeyboardState newKeyboardState, MouseState newMouseState, Game1 parent) { if (parent.Window.ClientBounds != _windowSize) { _windowSize = parent.Window.ClientBounds; windowResized(parent.Window.ClientBounds); } if (!newKeyboardState.IsKeyDown(Keys.Escape) && _keyboardState.IsKeyDown(Keys.Escape)) _menu.Visible = !_menu.Visible; bool isClick = false; if (_mouseState != newMouseState) { mouse.Position = new Rectangle(newMouseState.X, newMouseState.Y, mouse.Position.Width, mouse.Position.Height); isClick = newMouseState.LeftButton == ButtonState.Pressed && _mouseState.LeftButton == ButtonState.Released; } _menu.HandleInput(newKeyboardState, newMouseState, parent); if (_menu.Choise == 0) parent.SwitchScene(Scene.MainMenu); if (newKeyboardState.IsKeyDown(Keys.Right)) map.Moving(new Vector2(5, 0), true); if (newKeyboardState.IsKeyDown(Keys.Left)) map.Moving(new Vector2(-5, 0), true); if (newKeyboardState.IsKeyDown(Keys.Up)) map.Moving(new Vector2(0, -5), true); if (newKeyboardState.IsKeyDown(Keys.Down)) map.Moving(new Vector2(0, 5), true); _keyboardState = newKeyboardState; _mouseState = newMouseState; }
public override void EndScene(Game1 parent) { StopAllConnections(); if (parent != null) this._windowSize = parent.Window.ClientBounds; foreach (AbstractMap abstractMap in this._maps) { abstractMap.Activation((Game1)null); abstractMap.WindowResized(this._windowSize); } InitMobs(); if (parent != null) foreach (List<Mob> list in this._mobs) { foreach (Mob mob in list) { mob.LoadContent(parent.Content); mob.WindowResized(this._windowSize); } } Reset(); Game1.son.Stop(); }