예제 #1
0
        /// <summary>
        /// Configuramos los controles
        /// </summary>
        void setupInput()
        {
            // setup input for jumping. we will allow z on the keyboard or a on the gamepad
            jumpInput = new VirtualButton();
            jumpInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Z));
            jumpInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.A));

            downInput = new VirtualButton();
            downInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Down));
            downInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.DPadDown));

            leftInput = new VirtualButton();
            leftInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Left));
            leftInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.DPadLeft));

            rightInput = new VirtualButton();
            rightInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Right));
            rightInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.DPadRight));

            testInput = new VirtualButton();
            testInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.C));

            // horizontal input from dpad, left stick or keyboard left/right
            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadLeftRight());
            xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickX());
            xAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
        }
예제 #2
0
        void setupInput()
        {
            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickX());
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));

            YAxisInput = new VirtualIntegerAxis();
            YAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadUpDown());
            YAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickY());
            YAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));

            // vertical input from dpad, left stick or keyboard up/down
            _jumpInput = new VirtualButton();
            _jumpInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.A));
            _jumpInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.A));

            _rollInput = new VirtualButton();
            _rollInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Q));
            _rollInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.X));

            _floatInput = new VirtualButton();
            _floatInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Space));

            _attackInput = new VirtualButton();
            _attackInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.F));
        }
        public InmatningsHanterare()
        {
            AvändKnapp = new VirtualButton();
            AvändKnapp.AddKeyboardKey(Keys.A).AddKeyboardKey(Keys.Enter).AddGamePadButton(0, Buttons.A);

            AttackKnapp = new VirtualButton();
            AttackKnapp.AddKeyboardKey(Keys.Z).AddGamePadButton(0, Buttons.X);

            HoppKnapp = new VirtualButton();
            HoppKnapp.AddKeyboardKey(Keys.X).AddGamePadButton(0, Buttons.A);

            UppKnapp = new VirtualButton();
            UppKnapp.AddKeyboardKey(Keys.Up).AddGamePadButton(0, Buttons.DPadUp);

            HögerKnapp = new VirtualButton();
            HögerKnapp.AddKeyboardKey(Keys.Right).AddGamePadButton(0, Buttons.DPadRight);

            VänsterKnapp = new VirtualButton();
            VänsterKnapp.AddKeyboardKey(Keys.Left).AddGamePadButton(0, Buttons.DPadLeft);

            NedKnapp = new VirtualButton();
            NedKnapp.AddKeyboardKey(Keys.Down).AddGamePadButton(0, Buttons.DPadDown);

            RörelseAxelX = new VirtualIntegerAxis();
            RörelseAxelX.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right).AddGamePadLeftStickX().AddGamePadDPadLeftRight();

            RörelseAxelY = new VirtualIntegerAxis();
            RörelseAxelY.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down).AddGamePadLeftStickY().AddGamePadDPadUpDown();

            VäljKnapp = new VirtualButton();
            VäljKnapp.AddKeyboardKey(Keys.Enter).AddGamePadButton(0, Buttons.A).AddGamePadButton(0, Buttons.Start);
        }
예제 #4
0
        private void SetupInput()
        {
            // setup input for shooting a gun. we will allow z on the keyboard or a on the gamepad
            _fireInput = new VirtualButton();
            _fireInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Space));
            _fireInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.RightShoulder));

            _jumpInput = new VirtualButton();
            //_jumpInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Space));
            _jumpInput.nodes.Add(new Nez.VirtualButton.GamePadButton(0, Buttons.A));

            _glassesInput = new VirtualButton();
            _glassesInput.nodes.Add(new VirtualButton.KeyboardKey(Keys.E));


            _endGame = new VirtualButton();
            _endGame.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.H));

            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickX());
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));


            // vertical input from dpad, left stick or keyboard up/down
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadUpDown());
            _yAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickY());
            _yAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));
        }
예제 #5
0
        private void SetupInput()
        {
            // horizontal input from dpad, left stick or keyboard left/right
            X_AxisInput = new VirtualIntegerAxis();
            X_AxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            X_AxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            X_AxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));
            X_AxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
            X_AxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            X_AxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());

            // vertical input from dpad, left stick or keyboard up/down
            Y_AxisInput = new VirtualIntegerAxis();
            Y_AxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            Y_AxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            Y_AxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S));
            Y_AxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));
            Y_AxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            Y_AxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());

            //Attack input
            AttackInput = new VirtualButton();
            AttackInput.Nodes.Add(new VirtualButton.MouseLeftButton());
            AttackInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.M));
            AttackInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.X));

            //Jump INput
            JumpInput = new VirtualButton();
            JumpInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Space));
            JumpInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));
        }
예제 #6
0
        void SetupInput()
        {
            // setup input for jumping. we will allow z on the keyboard or a on the gamepad
            _jumpInput = new VirtualButton();
            _jumpInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Z));
            _jumpInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));

            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left,
                                                               Keys.Right));

            // vertical input of ^, used for dashing
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            _yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up,
                                                               Keys.Down));

            // running input, left shift on keyboard and b on gamepad
            _runInput = new VirtualButton();
            _runInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.LeftShift));
            _runInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.B));

            //dash input, X on keyboard and X on gamepad
            _dashInput = new VirtualButton();
            _dashInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.X));
            _dashInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.X));
        }
예제 #7
0
        public static void Begin(Level self)
        {
            if (Settings.Enabled)
            {
                PlayerTwoDash = new VirtualButton();
                PlayerTwoDash.Nodes.Add(new VirtualButton.KeyboardKey(Keys.J));
                PlayerTwoJump = new VirtualButton();
                PlayerTwoJump.Nodes.Add(new VirtualButton.KeyboardKey(Keys.K));
                PlayerTwoGrab = new VirtualButton();
                PlayerTwoGrab.Nodes.Add(new VirtualButton.KeyboardKey(Keys.H));
                PlayerTwoMoveX = new VirtualIntegerAxis();
                PlayerTwoMoveX.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehaviors.TakeNewer, Keys.NumPad4, Keys.NumPad6));
                PlayerTwoMoveY = new VirtualIntegerAxis();
                PlayerTwoMoveY.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehaviors.TakeNewer, Keys.NumPad8, Keys.NumPad5));
                PlayerTwoAim = new VirtualJoystick(true);
                PlayerTwoAim.Nodes.Add(new VirtualJoystick.KeyboardKeys(VirtualInput.OverlapBehaviors.TakeNewer, Keys.NumPad4, Keys.NumPad6, Keys.NumPad8, Keys.NumPad5));

                Player    P1        = Celeste.Scene.Entities.FindFirst <Player>();
                PlayerTwo Madeline2 = new PlayerTwo(P1.Position, PlayerSpriteMode.MadelineNoBackpack)
                {
                    IntroType = PlayerTwo.IntroTypes.None
                };
                Celeste.Scene.Entities.Add(Madeline2);
            }

            orig_Begin(self);
        }
예제 #8
0
 public void SetupInput()
 {
     _xAxisInput = new VirtualIntegerAxis();
     _xAxisInput.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right);
     _yAxisInput = new VirtualIntegerAxis();
     _yAxisInput.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down)
     .AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S);
 }
        public InputManager()
        {
            _interactionButton = new VirtualButton();
            _interactionButton
            .addKeyboardKey(Keys.X)
            .addKeyboardKey(Keys.Z)
            .addKeyboardKey(Keys.C)
            .addKeyboardKey(Keys.Space)
            .addKeyboardKey(Keys.Enter)
            .addGamePadButton(0, Buttons.A)
            .addGamePadButton(0, Buttons.X);

            _returnTimeButton = new VirtualButton();
            _returnTimeButton
            .addKeyboardKey(Keys.X)
            .addGamePadButton(0, Buttons.B);

            _timeSlowdownButton = new VirtualButton();
            _timeSlowdownButton
            .addKeyboardKey(Keys.Z)
            .addGamePadButton(0, Buttons.Y);

            _bushButton = new VirtualButton();
            _bushButton
            .addKeyboardKey(Keys.C)
            .addGamePadButton(0, Buttons.X);

            _jumpButton = new VirtualButton();
            _jumpButton
            .addKeyboardKey(Keys.Space)
            .addGamePadButton(0, Buttons.A);

            _upButton = new VirtualButton();
            _upButton
            .addKeyboardKey(Keys.Up)
            .addGamePadButton(0, Buttons.DPadUp);

            _downButton = new VirtualButton();
            _downButton
            .addKeyboardKey(Keys.Down)
            .addGamePadButton(0, Buttons.DPadDown);

            _movementAxis = new VirtualIntegerAxis();
            _movementAxis
            .addKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right)
            .addGamePadLeftStickX()
            .addGamePadDPadLeftRight();

            _selectButton = new VirtualButton();
            _selectButton
            .addKeyboardKey(Keys.Enter)
            .addGamePadButton(0, Buttons.A)
            .addGamePadButton(0, Buttons.Start);
        }
예제 #10
0
 protected ControlScheme()
 {
     LMove    = new VirtualButton();
     RMove    = new VirtualButton();
     LRotate  = new VirtualButton();
     RRotate  = new VirtualButton();
     Hold     = new VirtualButton();
     SoftDrop = new VirtualButton();
     HardDrop = new VirtualButton();
     MoveAxis = new VirtualIntegerAxis(new RepeatingButtonAxis(LMove, RMove));
 }
예제 #11
0
        public PlayerControllerSystem(World world) : base(world)
        {
            ecsContext     = world;
            horizontalAxis = new VirtualIntegerAxis();
            horizontalAxis.AddKeyboardKeys(VirtualInput.OverlapBehavior.CancelOut, Keys.A, Keys.D);

            verticalAxis = new VirtualIntegerAxis();
            verticalAxis.AddKeyboardKeys(VirtualInput.OverlapBehavior.CancelOut, Keys.S, Keys.W);

            shootButton = new VirtualButton();
            shootButton.AddMouseLeftButton();
        }
예제 #12
0
        private void SetupInput()
        {
            _primaryAttackInput = new VirtualButton();
            _primaryAttackInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Space));

            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));

            // vertical input from dpad, left stick or keyboard up/down
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S));
        }
예제 #13
0
        void SetupInput()
        {
            // setup input for jumping. we will allow z on the keyboard or a on the gamepad
            _jumpInput = new VirtualButton();
            _jumpInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Z));
            _jumpInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));

            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
        }
        void SetupInput()
        {
            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));

            // vertical input from dpad, left stick or keyboard up/down
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            _yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));
        }
예제 #15
0
        void setupInput()
        {
            // setup input for shooting a fireball. we will allow z on the keyboard or a on the gamepad
            fireInput = new VirtualButton();
            fireInput.Nodes.Add(new Nez.VirtualButton.MouseLeftButton());

            // horizontal input from dpad, left stick or keyboard left/right
            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.Nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));

            // vertical input from dpad, left stick or keyboard up/down
            yAxisInput = new VirtualIntegerAxis();
            yAxisInput.Nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S));
        }
예제 #16
0
        void SetupInput()
        {
            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));

            yAxisInput = new VirtualIntegerAxis();
            yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));

            primaryAttackInput = new VirtualButton();
            primaryAttackInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Z));

            jumpInput = new VirtualButton();
            jumpInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Space));
        }
예제 #17
0
        void setupInput()
        {
            //setup input for flying space or a on gamepad
            _flyInput = new VirtualButton();
            _flyInput.nodes.Add(new VirtualButton.KeyboardKey(Microsoft.Xna.Framework.Input.Keys.Space));
            _flyInput.nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));

            // horizontal input from dpad left stidk or keyboard left rights or a d
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.nodes.Add(new VirtualAxis.GamePadLeftStickX());
            _xAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
            _xAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));
        }
예제 #18
0
        void setupInput()
        {
            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            xAxisInput.nodes.Add(new VirtualAxis.GamePadLeftStickX());
            xAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
            xAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));

            yAxisInput = new VirtualIntegerAxis();
            yAxisInput.nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            yAxisInput.nodes.Add(new VirtualAxis.GamePadLeftStickY());
            yAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));
            yAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S));
        }
예제 #19
0
        public InputManager()
        {
            _interactionButton = new VirtualButton();
            _interactionButton
            .addKeyboardKey(Keys.A)
            .addKeyboardKey(Keys.Enter)
            .addGamePadButton(0, Buttons.A);

            _attackButton = new VirtualButton();
            _attackButton
            .addKeyboardKey(Keys.A)
            .addGamePadButton(0, Buttons.X);

            _takeThrowButton = new VirtualButton();
            _takeThrowButton
            .addKeyboardKey(Keys.S)
            .addGamePadButton(0, Buttons.Y);

            _rollButton = new VirtualButton();
            _rollButton
            .addKeyboardKey(Keys.D)
            .addGamePadButton(0, Buttons.B);

            _jumpButton = new VirtualButton();
            _jumpButton
            .addKeyboardKey(Keys.W)
            .addGamePadButton(0, Buttons.A);

            _upButton = new VirtualButton();
            _upButton
            .addKeyboardKey(Keys.Up)
            .addGamePadButton(0, Buttons.DPadUp);

            _downButton = new VirtualButton();
            _downButton
            .addKeyboardKey(Keys.Down)
            .addGamePadButton(0, Buttons.DPadDown);

            _movementAxis = new VirtualIntegerAxis();
            _movementAxis
            .addKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right)
            .addGamePadLeftStickX()
            .addGamePadDPadLeftRight();

            _selectButton = new VirtualButton();
            _selectButton
            .addKeyboardKey(Keys.Enter)
            .addGamePadButton(0, Buttons.A)
            .addGamePadButton(0, Buttons.Start);
        }
예제 #20
0
        private void SetupInput()
        {
            // Horizontal input from dpad, left stick or keyboard q/d
            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            xAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Q, Keys.D));

            // Vertical input from dpad, left stick or keyboard z/s
            yAxisInput = new VirtualIntegerAxis();
            yAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            yAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Z, Keys.S));
        }
예제 #21
0
        private void setUpInput()
        {
            upButton = new VirtualButton();
            upButton.nodes.Add(new KeyboardKey(Keys.Up));

            downButton = new VirtualButton();
            downButton.nodes.Add(new KeyboardKey(Keys.Down));

            rightButton = new VirtualButton();
            rightButton.nodes.Add(new KeyboardKey(Keys.Right));

            leftButton = new VirtualButton();
            leftButton.nodes.Add(new KeyboardKey(Keys.Left));

            attackButton = new VirtualButton();
            attackButton.nodes.Add(new KeyboardKey(Keys.X));

            switchButton = new VirtualButton();
            switchButton.nodes.Add(new KeyboardKey(Keys.Tab));

            itemsWindowButton = new VirtualButton();
            itemsWindowButton.nodes.Add(new KeyboardKey(Keys.Q));

            equitWindowButton = new VirtualButton();
            equitWindowButton.nodes.Add(new KeyboardKey(Keys.W));


            xVirtualAxis = new VirtualIntegerAxis();
            xVirtualAxis.nodes.Add(new KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));

            yVirtualAxis = new VirtualIntegerAxis();
            yVirtualAxis.nodes.Add(new KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));


            AButton = new VirtualButton();
            AButton.nodes.Add(new KeyboardKey(Keys.A));

            SButton = new VirtualButton();
            SButton.nodes.Add(new KeyboardKey(Keys.S));

            DButton = new VirtualButton();
            DButton.nodes.Add(new KeyboardKey(Keys.D));

            FButton = new VirtualButton();
            FButton.nodes.Add(new KeyboardKey(Keys.F));

            GButton = new VirtualButton();
            GButton.nodes.Add(new KeyboardKey(Keys.G));
        }
예제 #22
0
        private void setupInput()
        {
            //setup action keys
            jumpInput = new VirtualButton();
            jumpInput.nodes.Add(new VirtualButton.KeyboardKey(Keys.W));

            sprintInput = new VirtualButton();
            sprintInput.nodes.Add(new VirtualButton.KeyboardKey(Keys.LeftShift));

            shootInput = new VirtualButton();
            shootInput.nodes.Add(new VirtualButton.KeyboardKey(Keys.Space));

            xAxisInput = new VirtualIntegerAxis();
            xAxisInput.nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));
        }
예제 #23
0
        /// <summary>
        /// Configures input for both keyboard and gamepad.
        /// </summary>
        private void SetupInput()
        {
            attackInput = new VirtualButton();
            attackInput.Nodes.Add(new VirtualButton.MouseLeftButton());
            attackInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));

            horizontalInput = new VirtualIntegerAxis();
            horizontalInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            horizontalInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            horizontalInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, leftKey, rightKey));

            verticalInput = new VirtualIntegerAxis();
            verticalInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            verticalInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            verticalInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, upKey, downKey));
        }
예제 #24
0
        public override void OnAddedToEntity()
        {
            _mover       = this.GetComponent <TiledMapMover>();
            _boxCollider = Entity.GetComponent <BoxCollider>();

            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Microsoft.Xna.Framework.Input.Keys.A, Microsoft.Xna.Framework.Input.Keys.D));

            _jumpInput = new VirtualButton();
            _jumpInput.Nodes.Add(new VirtualButton.KeyboardKey(Microsoft.Xna.Framework.Input.Keys.Space));

            _animator = Entity.AddComponent <SpriteAnimator>();
            atlas     = thisScene.Content.LoadSpriteAtlas("Content/out.atlas");
            _animator.AddAnimationsFromAtlas(atlas);
            camera = this.GetComponent <Camera>();
        }
예제 #25
0
        /// <summary>
        ///     Define the controls.
        /// </summary>
        public Controls()
        {
            Flashlight = new VirtualButton();
            Flashlight.Nodes.Add(new VirtualButton.KeyboardKey(Keys.T));

            Interact = new VirtualButton();
            Interact.Nodes.Add(new VirtualButton.KeyboardKey(Keys.I));

            Run = new VirtualButton();
            Run.Nodes.Add(new VirtualButton.KeyboardKey(Keys.LeftShift));

            XAxis = new VirtualIntegerAxis();
            XAxis.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            XAxis.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            XAxis.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left,
                                                         Keys.Right));
        }
예제 #26
0
        public override void onAddedToEntity()
        {
            _mState   = EntityConstants.MovementStates.JUMP;
            _velocity = new Vector2(0, 0);

            _jumpInput = new VirtualButton();
            _jumpInput.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Up));

            _test = new VirtualButton();
            _test.nodes.Add(new Nez.VirtualButton.KeyboardKey(Keys.Down));

            _movementInput = new VirtualIntegerAxis();
            _movementInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));
            _mover = new Mover();

            this.entity.addComponent(_mover);
            this.entity.addComponent(new BoxCollider());
        }
예제 #27
0
        /// <summary>
        /// Needs a better way to bind keys, just hard bind for now
        /// </summary>
        public void SetupInput()
        {
            _axialInput = Vector2.Zero;
            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadLeftRight(gamepadIndex));
            _xAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickX(gamepadIndex));
            for (int i = 0; i < mapping.Left.Length; i++)
            {
                _xAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, (Keys)mapping.Left[i], (Keys)mapping.Right[i]));
            }

            // vertical input from dpad, left stick or keyboard up/down
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadDpadUpDown(gamepadIndex));
            _yAxisInput.nodes.Add(new Nez.VirtualAxis.GamePadLeftStickY(gamepadIndex));
            for (int i = 0; i < mapping.Up.Length; i++)
            {
                _yAxisInput.nodes.Add(new Nez.VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, (Keys)mapping.Up[i], (Keys)mapping.Down[i]));
            }

            //action buttons
            _jumpButton = new VirtualButton();
            foreach (var key in mapping.jumpKey)
            {
                _jumpButton.nodes.Add(new Nez.VirtualButton.KeyboardKey((Keys)key));
            }
            foreach (var button in mapping.jumpButton)
            {
                _jumpButton.nodes.Add(new Nez.VirtualButton.GamePadButton(gamepadIndex, (Buttons)button));
            }


            _shootButton = new VirtualButton();
            foreach (var key in mapping.shootKey)
            {
                _shootButton.nodes.Add(new Nez.VirtualButton.KeyboardKey((Keys)key));
            }
            foreach (var button in mapping.shootButton)
            {
                _shootButton.nodes.Add(new Nez.VirtualButton.GamePadButton(gamepadIndex, (Buttons)button));
            }
        }
예제 #28
0
        void SetupInput()
        {
            // setup input for shooting a fireball. we will allow z on the keyboard or a on the gamepad
            _fireInput = new VirtualButton();
            _fireInput.Nodes.Add(new VirtualButton.KeyboardKey(Keys.Z));
            _fireInput.Nodes.Add(new VirtualButton.GamePadButton(0, Buttons.A));

            // horizontal input from dpad, left stick or keyboard left/right
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadLeftRight());
            _xAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickX());
            _xAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Left, Keys.Right));

            // vertical input from dpad, left stick or keyboard up/down
            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadDpadUpDown());
            _yAxisInput.Nodes.Add(new VirtualAxis.GamePadLeftStickY());
            _yAxisInput.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.Up, Keys.Down));
        }
예제 #29
0
        void Controles()
        {
            _xAxisInput = new VirtualIntegerAxis();
            _xAxisInput.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D);

            _yAxisInput = new VirtualIntegerAxis();
            _yAxisInput.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S);

            _fireInput = new VirtualButton();
            _fireInput.AddMouseLeftButton();

            _runInput = new VirtualButton();
            _runInput.AddKeyboardKey(Keys.Space);

            _weapon1Input = new VirtualButton();
            _weapon1Input.AddKeyboardKey(Keys.D1);
            _weapon2Input = new VirtualButton();
            _weapon2Input.AddKeyboardKey(Keys.D2);
            _weapon3Input = new VirtualButton();
            _weapon3Input.AddKeyboardKey(Keys.D3);
        }
예제 #30
0
        static InputManager()
        {
            xAxis = new VirtualAxis();
            xAxis.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D));
            xAxis.Nodes.Add(new VirtualAxis.GamePadLeftStickX());

            yAxis = new VirtualAxis();
            yAxis.Nodes.Add(new VirtualAxis.KeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.W, Keys.S));
            yAxis.Nodes.Add(new VirtualAxis.GamePadLeftStickY());

            joystick = new VirtualJoystick(false);
            joystick.AddKeyboardKeys(VirtualInput.OverlapBehavior.TakeNewer, Keys.A, Keys.D, Keys.W, Keys.S);
            joystick.AddGamePadLeftStick();

            brake = new VirtualButton();
            brake.AddKeyboardKey(Keys.LeftShift);
            // TODO: add gamepad button for braking

            dash = new VirtualButton();
            dash.AddKeyboardKey(Keys.Space);
            // TODO: add gamepad button for dashing

            dispense = new VirtualButton();
            dispense.AddKeyboardKey(Keys.F);
            // TODO: add gamepad button for dispensing

            shoot = new VirtualButton();
            shoot.AddMouseLeftButton();
            shoot.AddGamePadRightTrigger(0, 0.2f);

            var prevKey     = new VirtualButton(new VirtualButton.KeyboardKey(Keys.Q));
            var nextKey     = new VirtualButton(new VirtualButton.KeyboardKey(Keys.E));
            var prevGamepad = new VirtualButton(new VirtualButton.GamePadButton(0, Buttons.X));
            var nextGamepad = new VirtualButton(new VirtualButton.GamePadButton(0, Buttons.A));

            switchWeapon = new VirtualIntegerAxis();
            switchWeapon.Nodes.Add(new ButtonAxis(prevKey, nextKey));
            switchWeapon.Nodes.Add(new ScrollAxis());
            switchWeapon.Nodes.Add(new ButtonAxis(prevGamepad, nextGamepad));
        }