public override void HandleInput(InputManager input) { if (input.CheckNewAction(InputAction.Selection)) { screenManager.ShowScreen(new ModelScreen()); } }
public ModelScreen() : base("Model") { background = ScreenManager.Game.Content.Load<Texture2D>("Model\\background"); inputManager = (InputManager)ScreenManager.Game.Services.GetService(typeof(InputManager)); model = new StaticModel(ScreenManager.Game.Content.Load<Model>("Model\\box")); model.Scale = 200.0f; modelRotation = 0.0f; // Set the position of the camera in world space, for our view matrix. cameraManager = (CameraManager)ScreenManager.Game.Services.GetService(typeof(CameraManager)); cameraManager.SetPosition(new Vector3(0.0f, 50.0f, 5000.0f)); }
public ScreenManager(Game game) { //Setup the game for use in all other screens ScreenManager.Game = game; //Setup the graphics device for later use ScreenManager.GraphicsDeviceManager = (GraphicsDeviceManager)game.Services.GetService(typeof(GraphicsDeviceManager)); //Create a sprite for use in all other screens ScreenManager.SpriteBatch = new SpriteBatch(game.GraphicsDevice); ScreenManager.InputManager = (InputManager)game.Services.GetService(typeof(InputManager)); screens = new List<Screen>(); }
public override void HandleInput(InputManager input) { base.HandleInput(input); if (input.CheckAction(InputAction.Selection)) { screenManager.ShowScreen(new ModelAndText()); } if (input.CheckAction(InputAction.RotateLeft)) { cameraManager.RotateX(-0.03f); } if (input.CheckAction(InputAction.RotateRight)) { cameraManager.RotateX(0.03f); } if (input.CheckAction(InputAction.RotateUp)) { cameraManager.RotateY(0.01f); } if (input.CheckAction(InputAction.RotateDown)) { cameraManager.RotateY(-0.01f); } if (input.CheckAction(InputAction.StrafeLeft)) { cameraManager.StrafeX(-10.0f); } if (input.CheckAction(InputAction.StrafeRight)) { cameraManager.StrafeX(10.0f); } if (input.CheckAction(InputAction.StrafeUp)) { cameraManager.StrafeY(10.0f); } if (input.CheckAction(InputAction.StrafeDown)) { cameraManager.StrafeY(-10.0f); } }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { //Setup some basic input inputManager = new InputManager(); inputManager.AddInput(InputAction.Selection, Keys.Enter); inputManager.AddInput(InputAction.Selection, Buttons.A); inputManager.AddInput(InputAction.Selection, Buttons.Start); //Menu Actions inputManager.AddInput(InputAction.MenuUp, Keys.Up); inputManager.AddInput(InputAction.MenuDown, Keys.Down); inputManager.AddInput(InputAction.MenuLeft, Keys.Left); inputManager.AddInput(InputAction.MenuRight, Keys.Right); inputManager.AddInput(InputAction.MenuSelect, Keys.Enter); inputManager.AddInput(InputAction.MenuCancel, Keys.Back); inputManager.AddInput(InputAction.MenuUp, Buttons.LeftThumbstickUp); inputManager.AddInput(InputAction.MenuDown, Buttons.LeftThumbstickDown); inputManager.AddInput(InputAction.MenuLeft, Buttons.LeftThumbstickLeft); inputManager.AddInput(InputAction.MenuRight, Buttons.LeftThumbstickRight); inputManager.AddInput(InputAction.MenuUp, Buttons.DPadUp); inputManager.AddInput(InputAction.MenuDown, Buttons.DPadDown); inputManager.AddInput(InputAction.MenuLeft, Buttons.DPadLeft); inputManager.AddInput(InputAction.MenuRight, Buttons.DPadRight); inputManager.AddInput(InputAction.MenuSelect, Buttons.A); inputManager.AddInput(InputAction.MenuCancel, Buttons.B); inputManager.AddInput(InputAction.ExitGame, Buttons.Back); inputManager.AddInput(InputAction.ExitGame, Keys.Escape); this.Services.AddService(typeof(InputManager), inputManager); //Movement Actions inputManager.AddInput(InputAction.TileMoveUp, Keys.T); inputManager.AddInput(InputAction.TileMoveDown, Keys.G); inputManager.AddInput(InputAction.TileMoveLeft, Keys.F); inputManager.AddInput(InputAction.TileMoveRight, Keys.H); inputManager.AddInput(InputAction.TileMoveUp, Buttons.LeftThumbstickUp); inputManager.AddInput(InputAction.TileMoveDown, Buttons.LeftThumbstickDown); inputManager.AddInput(InputAction.TileMoveLeft, Buttons.LeftThumbstickLeft); inputManager.AddInput(InputAction.TileMoveRight, Buttons.LeftThumbstickRight); //Tower Action inputManager.AddInput(InputAction.TowerBuild, Keys.Space); inputManager.AddInput(InputAction.TowerBuild, Buttons.A); inputManager.AddInput(InputAction.TowerDestroy, Keys.B); inputManager.AddInput(InputAction.TowerDestroy, Buttons.B); inputManager.AddInput(InputAction.TowerRepair, Keys.N); inputManager.AddInput(InputAction.TowerRepair, Buttons.Y); inputManager.AddInput(InputAction.TowerUpgrade, Keys.M); inputManager.AddInput(InputAction.TowerUpgrade, Buttons.X); //PlayerMenu inputManager.AddInput(InputAction.PlayerMenuLeft, Buttons.DPadLeft); inputManager.AddInput(InputAction.PlayerMenuRight, Buttons.DPadRight); inputManager.AddInput(InputAction.PlayerMenuUp, Buttons.DPadUp); inputManager.AddInput(InputAction.PlayerMenuDown, Buttons.DPadDown); inputManager.AddInput(InputAction.PlayerMenuLeft, Keys.J); inputManager.AddInput(InputAction.PlayerMenuRight, Keys.L); inputManager.AddInput(InputAction.PlayerMenuUp, Keys.I); inputManager.AddInput(InputAction.PlayerMenuDown, Keys.K); //UnitAction inputManager.AddInput(InputAction.UnitBuild, Buttons.RightTrigger); inputManager.AddInput(InputAction.UnitBuild, Keys.U); inputManager.AddInput(InputAction.UnitLeft, Buttons.RightThumbstickLeft); inputManager.AddInput(InputAction.UnitRight, Buttons.RightThumbstickRight); inputManager.AddInput(InputAction.UnitUp, Buttons.RightThumbstickUp); inputManager.AddInput(InputAction.UnitDown, Buttons.RightThumbstickDown); inputManager.AddInput(InputAction.UnitLeft, Keys.A); inputManager.AddInput(InputAction.UnitRight, Keys.D); inputManager.AddInput(InputAction.UnitUp, Keys.W); inputManager.AddInput(InputAction.UnitDown, Keys.S); //GameLobby inputManager.AddInput(InputAction.StartGame, Buttons.X); inputManager.AddInput(InputAction.BackToMainMenu, Buttons.Y); inputManager.AddInput(InputAction.JoinGame, Buttons.A); inputManager.AddInput(InputAction.TeamUp, Buttons.LeftThumbstickUp); inputManager.AddInput(InputAction.TeamDown, Buttons.LeftThumbstickDown); inputManager.AddInput(InputAction.TeamUp, Buttons.DPadUp); inputManager.AddInput(InputAction.TeamUp, Buttons.DPadDown); inputManager.AddInput(InputAction.StartGame, Keys.X); inputManager.AddInput(InputAction.BackToMainMenu, Keys.Y); inputManager.AddInput(InputAction.JoinGame, Keys.A); inputManager.AddInput(InputAction.TeamUp, Keys.Up); inputManager.AddInput(InputAction.TeamDown, Keys.Down); inputManager.AddInput(InputAction.HUD, Buttons.LeftStick); inputManager.AddInput(InputAction.HUD, Keys.H); inputManager.AddInput(InputAction.PickEnemyTarget, Buttons.LeftShoulder); inputManager.AddInput(InputAction.PickEnemyTarget, Keys.Q); inputManager.AddInput(InputAction.TowerInformation, Buttons.RightShoulder); inputManager.AddInput(InputAction.TowerInformation, Keys.P); inputManager.AddInput(InputAction.Pause, Buttons.Start); inputManager.AddInput(InputAction.Pause, Keys.Z); inputManager.AddInput(InputAction.PowerActivate, Buttons.LeftTrigger); inputManager.AddInput(InputAction.PowerActivate, Keys.A); //Setup Screen Manager screenManager = new ScreenManager(this); this.Services.AddService(typeof(ScreenManager), screenManager); //Setup Camera cameraManager = new CameraManager(); this.Services.AddService(typeof(CameraManager), cameraManager); //Set Starting Screen screenManager.ShowScreen(new IntroScreen()); }
public override void HandleInput(InputManager input) { base.HandleInput(input); if (input.CheckAction(InputAction.Selection)) { ScreenManager.ShowScreen(new AnimatedModelScreen()); } //Check if rotation key is pressed if (input.CheckAction(InputAction.Rotation)) { //toggle rotation if (startAnimation == true) startAnimation = false; else startAnimation = true; } }
public override void HandleInput(InputManager input) { base.HandleInput(input); bool moveModel = false; Tile newTile = new Tile(); if (input.CheckNewAction(InputAction.TileMoveUp)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Up); } if (input.CheckNewAction(InputAction.TileMoveDown)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Down); } if (input.CheckNewAction(InputAction.TileMoveLeft)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Left); } if (input.CheckNewAction(InputAction.TileMoveRight)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Right); } if (!newTile.IsNull()) currentTile = newTile; if(input.CheckNewAction(InputAction.Selection)) { //units.Add(new TestUnit(startBase.GetTile().Position)); } //if (input.CheckNewAction(InputAction.Selection)) //{ // for (int i = 0; i < units.Count; i++) // { // units[i].SetPosition(new Vector3(rand.Next(-99, 99), 0, rand.Next(-99, 99))); // units[i].GetTile(); // } // //ScreenManager.Game.Exit(); //} if (input.CheckAction(InputAction.RotateLeft)) { cameraManager.RotateX(-0.03f); } if (input.CheckAction(InputAction.RotateRight)) { cameraManager.RotateX(0.03f); } if (input.CheckAction(InputAction.RotateUp)) { cameraManager.RotateY(0.01f); } if (input.CheckAction(InputAction.RotateDown)) { cameraManager.RotateY(-0.01f); } if (input.CheckAction(InputAction.StrafeLeft)) { cameraManager.StrafeX(-10.0f); } if (input.CheckAction(InputAction.StrafeRight)) { cameraManager.StrafeX(10.0f); } if (input.CheckAction(InputAction.StrafeUp)) { cameraManager.StrafeY(10.0f); } if (input.CheckAction(InputAction.StrafeDown)) { cameraManager.StrafeY(-10.0f); } if (moveModel) myModel.SetPosition(currentTile.Position); if (input.CheckNewAction(InputAction.TowerBuild)) { BuildTower(currentTile); } }
public override void HandleInput(InputManager input) { base.HandleInput(input); bool moveModel = false; Tile newTile = new Tile(); if (input.CheckNewAction(InputAction.TileMoveUp)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Up); } if (input.CheckNewAction(InputAction.TileMoveDown)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Down); } if (input.CheckNewAction(InputAction.TileMoveLeft)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Left); } if (input.CheckNewAction(InputAction.TileMoveRight)) { moveModel = true; newTile = TileMap.GetTileNeighbor(currentTile, NeighborTile.Right); } if (!newTile.IsNull()) currentTile = newTile; if (input.CheckAction(InputAction.Selection)) { AddUnit(new TestUnit(startBase.Position, goalBase)); AddUnit(new TestUnit(goalBase.Position, startBase)); } if (moveModel) myModel.SetPosition(currentTile.Position); if (input.CheckNewAction(InputAction.TowerBuild)) { BuildTower(currentTile); } }
/// <summary> /// Handles input logic /// </summary> /// <param name="input">The input manager for the game</param> public virtual void HandleInput(InputManager input) { }
/// <summary> /// LoadContent will be called once per game and is the place to load /// all of your content. /// </summary> protected override void LoadContent() { //Setup some basic input inputManager = new InputManager(); inputManager.AddInput(InputAction.Selection, Keys.Enter); inputManager.AddInput(InputAction.Rotation, Keys.Space); inputManager.AddInput(InputAction.RotateUp, Keys.Up); inputManager.AddInput(InputAction.RotateUp, Keys.I); inputManager.AddInput(InputAction.RotateDown, Keys.Down); inputManager.AddInput(InputAction.RotateLeft, Keys.Left); inputManager.AddInput(InputAction.RotateRight, Keys.Right); inputManager.AddInput(InputAction.StrafeUp, Keys.W); inputManager.AddInput(InputAction.StrafeDown, Keys.S); inputManager.AddInput(InputAction.StrafeLeft, Keys.A); inputManager.AddInput(InputAction.StrafeRight, Keys.D); //Menu Actions inputManager.AddInput(InputAction.MenuUp, Keys.Up); inputManager.AddInput(InputAction.MenuDown, Keys.Down); inputManager.AddInput(InputAction.MenuSelect, Keys.Enter); inputManager.AddInput(InputAction.MenuCancel, Keys.Back); this.Services.AddService(typeof(InputManager), inputManager); //Movement Actions inputManager.AddInput(InputAction.TileMoveUp, Keys.T); inputManager.AddInput(InputAction.TileMoveDown, Keys.G); inputManager.AddInput(InputAction.TileMoveLeft, Keys.F); inputManager.AddInput(InputAction.TileMoveRight, Keys.H); //Tower Action inputManager.AddInput(InputAction.TowerBuild, Keys.Space); //Setup Screen Manager screenManager = new ScreenManager(this); //Setup Camera cameraManager = new CameraManager(); this.Services.AddService(typeof(CameraManager), cameraManager); //Set Starting Screen screenManager.ShowScreen(new MenuScreenTest()); }
public override void HandleInput(InputManager input) { // Move to the previous menu entry if (input.CheckNewAction(InputAction.MenuUp)) { selectedEntry--; if (selectedEntry < 0) selectedEntry = menuEntries.Count - 1; } // Move to the next menu entry if (input.CheckNewAction(InputAction.MenuDown)) { selectedEntry++; if (selectedEntry >= menuEntries.Count) selectedEntry = 0; } if (input.CheckNewAction(InputAction.MenuSelect)) OnSelectEntry(selectedEntry); else if (input.CheckNewAction(InputAction.MenuCancel)) OnCancel(); }