コード例 #1
0
        public KeyboardInputHandler(VirtualController vc, List <Keybinding> bindings)
        {
            virtualController = vc;

            foreach (var binding in bindings)
            {
                getKeyDownBindings.Add(binding.KeyboardBinding, binding.ButtonHandler);
                getKeyUpBindings.Add(binding.KeyboardBinding, binding.ButtonHandler);
            }
        }
コード例 #2
0
        private void Start()
        {
            GetButtonHandlers();

            controller  = new VirtualController(this);
            player      = GetComponent <Player>();
            jumpButton  = (JumpButton)buttons.Find(x => x.GetType().Equals(typeof(JumpButton)));
            shootButton = (ShootButton)buttons.Find(x => x.GetType().Equals(typeof(ShootButton)));
            move        = player.GetAbility <MoveComponent>();
        }
コード例 #3
0
        public ControllerInputHandler(VirtualController vc, List <Keybinding> bindings)
        {
            virtualController = vc;


            foreach (var binding in bindings)
            {
                getKeyDownBindings.Add(ButtonBindings[binding.ControllerBinding], binding.ButtonHandler);
                getKeyUpBindings.Add(ButtonBindings[binding.ControllerBinding], binding.ButtonHandler);
            }
        }
コード例 #4
0
        public ControllerInputHandler(VirtualController vc)
        {
            virtualController = vc;

            getKeyDownBindings.Add(A_BUTTON, InputLabels.JumpPressed);
            getKeyDownBindings.Add(L_BUMPER, InputLabels.ShieldPressed);
            getKeyDownBindings.Add(X_BUTTON, InputLabels.MeleePressed);
            getKeyDownBindings.Add(B_BUTTON, InputLabels.CycleShieldColourPressed);
            getKeyDownBindings.Add(START_BUTTON, InputLabels.ToggleMenu);

            getKeyUpBindings.Add(A_BUTTON, InputLabels.JumpReleased);
            getKeyUpBindings.Add(L_BUMPER, InputLabels.ShieldReleased);
            getKeyUpBindings.Add(X_BUTTON, InputLabels.MeleeReleased);
        }
コード例 #5
0
        private void Start()
        {
            player = GetComponent <Player>();

            // Create button handlers from keybindings
            for (int i = 0; i < KeyBindings.Count; i++)
            {
                Type type    = Type.GetType(KeyBindings[i].HandlerTypeString);
                var  binding = KeyBindings[i];
                binding.ButtonHandler = (PlayerControllerButtonHandler)Activator.CreateInstance(type, player, this);
                KeyBindings[i]        = binding;
                buttonHandlers.Add(KeyBindings[i].ButtonHandler);
            }

            controller = new VirtualController(this, KeyBindings);

            move = player.GetAbility <MoveComponent>();
        }
コード例 #6
0
        public KeyboardInputHandler(VirtualController vc)
        {
            virtualController = vc;

            getKeyDownBindings.Add(KeyCode.W, InputLabels.JumpPressed);
            getKeyDownBindings.Add(KeyCode.Space, InputLabels.JumpPressed);
            getKeyDownBindings.Add(KeyCode.S, InputLabels.StompPressed);
            getKeyDownBindings.Add(KeyCode.F, InputLabels.MeleePressed);
            getKeyDownBindings.Add(KeyCode.Mouse0, InputLabels.ShootPressed);
            getKeyDownBindings.Add(KeyCode.Mouse1, InputLabels.ShieldPressed);
            getKeyDownBindings.Add(KeyCode.R, InputLabels.CycleShieldColourPressed);
            getKeyDownBindings.Add(KeyCode.Escape, InputLabels.ToggleMenu);

            getKeyUpBindings.Add(KeyCode.W, InputLabels.JumpReleased);
            getKeyUpBindings.Add(KeyCode.Space, InputLabels.JumpReleased);
            getKeyUpBindings.Add(KeyCode.Mouse0, InputLabels.ShootReleased);
            getKeyUpBindings.Add(KeyCode.Mouse1, InputLabels.ShieldReleased);
        }