/// <summary>
 /// Implements ICloneable interface.
 /// </summary>
 /// <returns>Cloned input map.</returns>
 public object Clone()
 {
     InputMap map = new InputMap();
     map._moveManager = _moveManager;
     map._currentBindIndex = _currentBindIndex;
     for (int i = 0; i < _inputNodes.Count; i++)
         map._inputNodes.Add(_inputNodes[i]);
     return map;
 }
 /// <summary>
 /// Push InputMap onto the InputMap stack.  Bindings in this map will be processed after all
 /// currently pushed maps.  If already pushed, this map will first be popped.
 /// </summary>
 /// <param name="map">Input map to push.</param>
 public void PushInputMap(InputMap map)
 {
     _inputMaps.Remove(map);
     _inputMaps.Add(map);
 }
        // setup user input
        protected void _setupInputMap()
        {
            MoveManager moveManager = new MoveManager();
            ProcessList.Instance.SetMoveManager(this, moveManager);
            InputMap inputMap = new InputMap();
            inputMap.MoveManager = moveManager;

            int gamePadNumber = Game.Instance.Players.Count - 1;
            int gamepadId = InputManager.Instance.FindDevice("gamepad" + gamePadNumber);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.LeftThumbX, MoveMapTypes.StickAnalogHorizontal, 0);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.LeftThumbY, MoveMapTypes.StickAnalogVertical, 0);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.A, MoveMapTypes.Button, 0);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.X, MoveMapTypes.Button, 1);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.Y, MoveMapTypes.Button, 2);
            inputMap.BindMove(gamepadId, (int)XGamePadDevice.GamePadObjects.LeftTrigger, MoveMapTypes.TriggerDigital, 0);
            inputMap.BindCommand(gamepadId, (int)XGamePadDevice.GamePadObjects.Back, null, Game.Instance.Exit);
            inputMap.BindCommand(gamepadId, (int)XGamePadDevice.GamePadObjects.Start, null, Game.Instance.TogglePause);

            #if !XBOX
            int keyboardId = InputManager.Instance.FindDevice("keyboard0");
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.Space, MoveMapTypes.Button, 0);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.D, MoveMapTypes.StickDigitalRight, 0);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.A, MoveMapTypes.StickDigitalLeft, 0);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.S, MoveMapTypes.StickDigitalDown, 0);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.U, MoveMapTypes.Button, 1);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.I, MoveMapTypes.Button, 2);
            inputMap.BindMove(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.O, MoveMapTypes.Button, 3);
            inputMap.BindCommand(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.P, null, Game.Instance.TogglePause);
            inputMap.BindCommand(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.R, null, Game.Instance.Reset);
            inputMap.BindCommand(keyboardId, (int)Microsoft.Xna.Framework.Input.Keys.Escape, null, Game.Instance.Exit);
            #endif

            InputManager.Instance.PushInputMap(inputMap.CloneInputMap());
        }
 /// <summary>
 /// Pop InputMap off the InputMap stack.  Bindings in this map will no longer be processed by
 /// InputManager.
 /// </summary>
 /// <param name="map">Input map to pop.</param>
 public void PopInputMap(InputMap map)
 {
     _inputMaps.Remove(map);
 }