private void ProccesKeyboardInput() { // Polling key presses is better than events if we // need to detect multiple key presses at same time if (!GameplayUI.InGameLog.ShowLog) { if (container.Show == false) { if (Keyboard.IsKeyPressed(Keyboard.Key.X)) { SpawnRandomSyringe(); } if (Keyboard.IsKeyPressed(Keyboard.Key.Z)) { MainPlayer.AddHealth(-1); } if (Keyboard.IsKeyPressed(Keyboard.Key.R)) { MainPlayer.Weapon.Reload(); } if (Mouse.IsButtonPressed(Mouse.Button.Left)) { var target = AimCursor.Position - MainPlayer.Position; MainPlayer.Weapon.Shoot(target, MainPlayer); } // Testing abstract factory if (Keyboard.IsKeyPressed(Keyboard.Key.O)) { //SpawnDestructible(); //SpawnIndestructible(); SpawnTraps(); } // testing builder if (Keyboard.IsKeyPressed(Keyboard.Key.H)) { director.ConstructBase(); GameState.TileMap = builder.GetResult(); } if (Keyboard.IsKeyPressed(Keyboard.Key.Q)) { MainPlayer.Toggle(); } if (Keyboard.IsKeyPressed(Keyboard.Key.G)) { MainPlayer.DropWeapon(); } if (Keyboard.IsKeyPressed(Keyboard.Key.Num1)) { if (MainPlayer.Weapon.Name != MainPlayer.HoldingWeapon[0].Name) { MainPlayer.SetWeapon(MainPlayer.HoldingWeapon[0]); } } if (Keyboard.IsKeyPressed(Keyboard.Key.Num2)) { if (MainPlayer.HoldingWeapon[1] != null && MainPlayer.Weapon.Name != MainPlayer.HoldingWeapon[1].Name) { MainPlayer.SetWeapon(MainPlayer.HoldingWeapon[1]); } } if (Keyboard.IsKeyPressed(Keyboard.Key.Num3)) { if (MainPlayer.HoldingWeapon[2] != null && MainPlayer.Weapon.Name != MainPlayer.HoldingWeapon[2].Name) { MainPlayer.SetWeapon(MainPlayer.HoldingWeapon[2]); } } if (Keyboard.IsKeyPressed(Keyboard.Key.M)) { Toggle(); } } // Menu if (Keyboard.IsKeyPressed(Keyboard.Key.P)) { container.ChangeVisibility(); } if (Keyboard.IsKeyPressed(Keyboard.Key.Space)) { container.selectButton(); container.chooseComposite(); if (container.composite.tempSelected <= 2) { container.composite.Accept(new CursorVisitor()); } else if (container.composite.tempSelected <= 4) { container.composite.Accept(new ControlsVisitor()); } else if (container.composite.tempSelected <= 6) { container.composite.Accept(new VolumeVisitor()); } container.returnComposite(); } } }