Ejemplo n.º 1
0
	public MonkActions(InputDevice device)
	{
		spawn0 = CreatePlayerAction ("Spawn0");
		spawn1 = CreatePlayerAction ("Spawn1");
		spawn2 = CreatePlayerAction ("Spawn2");
		spawn3 = CreatePlayerAction ("Spawn3");
		fireTurret = CreatePlayerAction ("FireTurret");
		moveUnitLeft = CreatePlayerAction ("MoveUnitLeft");
		moveUnitRight = CreatePlayerAction ("MoveUnitRight");
		moveHorizontal = CreateOneAxisPlayerAction (moveUnitLeft, moveUnitRight);

		moveUnitUp = CreatePlayerAction ("MoveUnitUp");
		moveUnitDown = CreatePlayerAction ("MoveUnitDown");
		moveVertical = CreateOneAxisPlayerAction (moveUnitDown,moveUnitUp);

		Device = device;

		spawn0.AddDefaultBinding (InputControlType.Action1);
		spawn1.AddDefaultBinding (InputControlType.Action2);
		spawn2.AddDefaultBinding (InputControlType.Action3);
		spawn3.AddDefaultBinding (InputControlType.Action4);
		fireTurret.AddDefaultBinding (InputControlType.RightTrigger);

		moveUnitLeft.AddDefaultBinding (InputControlType.LeftStickLeft);
		moveUnitRight.AddDefaultBinding (InputControlType.LeftStickRight);
		moveUnitUp.AddDefaultBinding (InputControlType.LeftStickUp);
		moveUnitDown.AddDefaultBinding (InputControlType.LeftStickDown);

	}
Ejemplo n.º 2
0
	public AttackerActions(InputDevice device)
	{
		attackerAttack = CreatePlayerAction ("AttackerAttack");

		moveAttackerLeft = CreatePlayerAction ("MoveUnitLeft");
		moveAttackerRight = CreatePlayerAction ("MoveUnitRight");
		moveAttackerHorizontal = CreateOneAxisPlayerAction (moveAttackerLeft, moveAttackerRight);
		moveAttackerUp = CreatePlayerAction ("MoveUnitUp");
		moveAttackerDown = CreatePlayerAction ("MoveUnitDown");
		moveAttackerVertical = CreateOneAxisPlayerAction (moveAttackerDown,moveAttackerUp);

		this.Device = device;

		attackerAttack.AddDefaultBinding (InputControlType.Action1);
		moveAttackerLeft.AddDefaultBinding (InputControlType.LeftStickLeft);
		moveAttackerRight.AddDefaultBinding (InputControlType.LeftStickRight);
		moveAttackerUp.AddDefaultBinding (InputControlType.LeftStickUp);
		moveAttackerDown.AddDefaultBinding (InputControlType.LeftStickDown);
	}
Ejemplo n.º 3
0
        public TestInputSet()
        {
            expand = CreatePlayerAction("Expand");
            //expand.AddDefaultBinding(Mouse.RightButton);
            //expand.AddDefaultBinding(Key.Space);
            //expand.AddDefaultBinding(InputControlType.Action4);

            cancel = CreatePlayerAction("Cancel");
            cancel.AddDefaultBinding(Mouse.RightButton);
            cancel.AddDefaultBinding(Key.Escape);
            cancel.AddDefaultBinding(InputControlType.Action2);

            {
                var up = CreatePlayerAction("Up");
                var down = CreatePlayerAction("Down");
                var left = CreatePlayerAction("Left");
                var right = CreatePlayerAction("Right");

                up.AddDefaultBinding(Key.W);
                down.AddDefaultBinding(Key.S);
                left.AddDefaultBinding(Key.A);
                right.AddDefaultBinding(Key.D);

                up.AddDefaultBinding(InputControlType.LeftStickUp);
                down.AddDefaultBinding(InputControlType.LeftStickDown);
                left.AddDefaultBinding(InputControlType.LeftStickLeft);
                right.AddDefaultBinding(InputControlType.LeftStickRight);

                move = CreateTwoAxisPlayerAction(left, right, down, up);
                move.StateThreshold = 0.5f;
            }

            {
                var cw = CreatePlayerAction("Turn CW");
                var acw = CreatePlayerAction("Turn ACW");

                cw.AddDefaultBinding(Key.E);
                acw.AddDefaultBinding(Key.Q);

                turn = CreateOneAxisPlayerAction(cw, acw);
            }

            {
                var up = CreatePlayerAction("Cursor Up");
                var down = CreatePlayerAction("Cursor Down");
                var left = CreatePlayerAction("Cursor Left");
                var right = CreatePlayerAction("Cursor Right");

                up.AddDefaultBinding(InputControlType.RightStickUp);
                down.AddDefaultBinding(InputControlType.RightStickDown);
                left.AddDefaultBinding(InputControlType.RightStickLeft);
                right.AddDefaultBinding(InputControlType.RightStickRight);

                cursor = CreateTwoAxisPlayerAction(left, right, down, up);

                click = CreatePlayerAction("Cursor Click");
                click.AddDefaultBinding(InputControlType.RightTrigger);
            }

            {
                var zoomIn = CreatePlayerAction("Zoom In");
                var zoomOut = CreatePlayerAction("Zoom Out");

                zoomIn.AddDefaultBinding(InputControlType.LeftStickButton);
                zoomOut.AddDefaultBinding(InputControlType.RightStickButton);

                zoomIn.AddDefaultBinding(Key.Equals);
                zoomOut.AddDefaultBinding(Key.Minus);

                zoom = CreateOneAxisPlayerAction(zoomOut, zoomIn);
            }
        }
 // Creates a Default binding on an action for both keyboard and controller inputs
 private void bindDefault( PlayerAction action, Key keyInput, InputControlType controllerInput )
 {
     action.AddDefaultBinding( keyInput );
     action.AddDefaultBinding( controllerInput );
 }
 // Creates a Default binding on an action for both mouse and controller inputs
 private void bindDefault( PlayerAction action, Mouse mouseInput, InputControlType controllerInput )
 {
     action.AddDefaultBinding( mouseInput );
     action.AddDefaultBinding( controllerInput );
 }
Ejemplo n.º 6
0
	public PlayerInput(bool haveGamepad)
	{
		_left 		= CreatePlayerAction("Move Left");
		_right 		= CreatePlayerAction("Move Right");
		_up 		= CreatePlayerAction("Move Up");
		_down 		= CreatePlayerAction("Move Down");
		move		= CreateTwoAxisPlayerAction(_left, _right, _down, _up);

		_shootLeft 	= CreatePlayerAction("Shoot Left");
		_shootRight	= CreatePlayerAction("Shoot Right");
		_shootUp 	= CreatePlayerAction("Shoot Up");
		_shootDown 	= CreatePlayerAction("Shoot Down");
		shoot		= CreateTwoAxisPlayerAction(_shootLeft, _shootRight, _shootDown, _shootUp);

		//Gamepad
		if(haveGamepad)
		{
			_left.AddDefaultBinding(InputControlType.LeftStickLeft);
			_right.AddDefaultBinding(InputControlType.LeftStickRight);
			_up.AddDefaultBinding(InputControlType.LeftStickUp);
			_down.AddDefaultBinding(InputControlType.LeftStickDown);

			_left.AddDefaultBinding(InputControlType.DPadLeft);
			_right.AddDefaultBinding(InputControlType.DPadRight);
			_up.AddDefaultBinding(InputControlType.DPadUp);
			_down.AddDefaultBinding(InputControlType.DPadDown);

			_shootLeft.AddDefaultBinding(InputControlType.RightStickLeft);
			_shootRight.AddDefaultBinding(InputControlType.RightStickRight);
			_shootUp.AddDefaultBinding(InputControlType.RightStickUp);
			_shootDown.AddDefaultBinding(InputControlType.RightStickDown);

			_shootLeft.AddDefaultBinding(InputControlType.Action3);
			_shootRight.AddDefaultBinding(InputControlType.Action2);
			_shootUp.AddDefaultBinding(InputControlType.Action4);
			_shootDown.AddDefaultBinding(InputControlType.Action1);
		}
		else
		{
			_left.AddDefaultBinding(Key.LeftArrow);
			_right.AddDefaultBinding(Key.RightArrow);
			_up.AddDefaultBinding(Key.UpArrow);
			_down.AddDefaultBinding(Key.DownArrow);

			_shootLeft.AddDefaultBinding(Key.A);
			_shootRight.AddDefaultBinding(Key.D);
			_shootUp.AddDefaultBinding(Key.W);
			_shootDown.AddDefaultBinding(Key.S);
		}
	}