Beispiel #1
0
        void OnEnable()
        {
            // See PlayerActions.cs for this setup.

            //playerActions.Move.OnLastInputTypeChanged += ( lastInputType ) => Debug.Log( lastInputType );

            inputBindings = InputBindings.CreateWithDefaultBindings();
            LoadBindings();
        }
Beispiel #2
0
        public static InputBindings CreateWithDefaultBindings()
        {
            var playerActions = new InputBindings();

            // How to set up mutually exclusive keyboard bindings with a modifier key.
            // playerActions.Back.AddDefaultBinding( Key.Shift, Key.Tab );
            // playerActions.Next.AddDefaultBinding( KeyCombo.With( Key.Tab ).AndNot( Key.Shift ) );

            playerActions.Left.AddDefaultBinding(Key.LeftArrow);
            playerActions.Left.AddDefaultBinding(Key.A);
            playerActions.Right.AddDefaultBinding(Key.RightArrow);
            playerActions.Right.AddDefaultBinding(Key.D);

            playerActions.Left.AddDefaultBinding(InputControlType.LeftStickLeft);
            playerActions.Right.AddDefaultBinding(InputControlType.LeftStickRight);

            playerActions.Left.AddDefaultBinding(InputControlType.RightStickLeft);
            playerActions.Right.AddDefaultBinding(InputControlType.RightStickRight);

            playerActions.SlowDown.AddDefaultBinding(Key.S);
            playerActions.SlowDown.AddDefaultBinding(InputControlType.LeftTrigger);

            playerActions.SpeedUp.AddDefaultBinding(Key.W);
            playerActions.SpeedUp.AddDefaultBinding(InputControlType.RightTrigger);

            playerActions.Pause.AddDefaultBinding(Key.Escape);
            playerActions.Pause.AddDefaultBinding(InputControlType.Start);

            playerActions.SlowSpeed.AddDefaultBinding(Key.Key1);
            playerActions.NormalSpeed.AddDefaultBinding(Key.Key2);
            playerActions.FastSpeed.AddDefaultBinding(Key.Key3);


            playerActions.ListenOptions.IncludeUnknownControllers   = true;
            playerActions.ListenOptions.MaxAllowedBindings          = 4;
            playerActions.ListenOptions.UnsetDuplicateBindingsOnSet = true;


            return(playerActions);
        }