/// <summary> /// Permet de gérer les entrées du joueur /// </summary> /// <param name="keyState">L'état du clavier à tester</param> /// <param name="mouseState">L'état de la souris à tester</param> /// <param name="joueurNum">Le numéro du joueur qui doit être surveillé</param> public void HandleInput(KeyboardState keyState, MouseState mouseState, Cursor cursor) { if (mouseState.LeftButton == ButtonState.Pressed && cursor.Position.X > Position.X && cursor.Position.X < (Position.X + Width) && cursor.Position.Y > Position.Y && cursor.Position.Y < (Position.Y + Height) && isVisible == true && oldMouse.LeftButton == ButtonState.Released) { status = true; } else { status = false; } if (cursor.Position.X > Position.X && cursor.Position.X < (Position.X + Width) && cursor.Position.Y > Position.Y && cursor.Position.Y < (Position.Y + Height)) { isHighLighted = true; } else { isHighLighted = false; } oldMouse = mouseState; }
/// <summary> /// Initialise les variables du Sprite /// </summary> public virtual void Initialize() { lastState = 1; musicMenu = ATexture.musicMenu; musicMenuInst = musicMenu.CreateInstance(); musicMenuInst.IsLooped = true; menuSoundState = "on"; cursor = new Cursor(ATexture.cursor8x8, 0, 0); background = new Sprite(ATexture.BG_Main_Menu, 0, 0); state = 1; }
/// <summary> /// Initialise les variables du Sprite /// </summary> public virtual void Initialize(Game1 _game) { lastState = 1; //VIDEO Intro = ATexture.Intro; if (state != 7) { Timer = 0; Freezed = false; playIntro = true; lvl_selected = 0; Drawmessage = false; menuSoundState = "on"; menuDisplayState = "Windowed"; menuVolumeChangeBGM = 70; menuVolumeChangeSFX = 30; selected = 0; state = 1; //Son musicMenu = ATexture.musicMenu; musicMenuInst = musicMenu.CreateInstance(); musicMenuInst.IsLooped = true; gameMusic = ATexture.gameMusic; gameMusicInst = gameMusic.CreateInstance(); gameMusicInst.IsLooped = true; music_project = ATexture.music_project; music_projectInst = music_project.CreateInstance(); music_projectInst.IsLooped = true; gameMusicInst.Volume = VolumeBGM; VolumeBGM = 0.7F; jump = ATexture.jump; jumpInst = jump.CreateInstance(); jumpInst.Volume = VolumeSFX; landing = ATexture.landing; landingInst = landing.CreateInstance(); landingInst.Volume = VolumeSFX; attack1 = ATexture.attack1; attack1Inst = attack1.CreateInstance(); attack1Inst.Volume = VolumeSFX; run_ground = ATexture.run_ground; run_groundInst = run_ground.CreateInstance(); run_groundInst.Volume = VolumeSFX; voice_dead = ATexture.voice_dead; voice_deadInst = voice_dead.CreateInstance(); voice_deadInst.Volume = VolumeSFX; get_item = ATexture.get_item; get_itemInst = get_item.CreateInstance(); get_itemInst.Volume = VolumeSFX; mouse_enter = ATexture.mouse_enter; mouse_enterInst = mouse_enter.CreateInstance(); mouse_enterInst.Volume = 1F; VolumeSFX = 0.3F; cursor = new Cursor(ATexture.cursor8x8, _game); background = new Sprite(ATexture.BG_Main_Menu, 0, 0); backgroundPause = new Sprite(ATexture.BG_Pause, 0, 0); backgroundGO = new Sprite(ATexture.BG_GO, 0, 0); } state = 7; }