예제 #1
0
        private static PlayerKeyInput InitKeyboardInput(int index, PlayerKeyInput input)
        {
            // TODO: don't hard code
            switch (index)
            {
            case 0:
            {
                input.Map(KeyCode.W, PlayerAction.Up);
                input.Map(KeyCode.A, PlayerAction.Left);
                input.Map(KeyCode.S, PlayerAction.Down);
                input.Map(KeyCode.D, PlayerAction.Right);
                input.Map(KeyCode.OemCloseBrackets, PlayerAction.Bomb);
                input.Map(KeyCode.OemOpenBrackets, PlayerAction.Special);
                break;
            }

            case 1:
            {
                input.Map(KeyCode.Up, PlayerAction.Up);
                input.Map(KeyCode.Left, PlayerAction.Left);
                input.Map(KeyCode.Down, PlayerAction.Down);
                input.Map(KeyCode.Right, PlayerAction.Right);
                input.Map(KeyCode.M, PlayerAction.Bomb);
                input.Map(KeyCode.N, PlayerAction.Special);
                break;
            }
            }

            return(input);
        }
예제 #2
0
        private static PlayerKeyInput CreateKeyBoardInput(int index)
        {
            if (keyboardInputs == null)
            {
                keyboardInputs = new PlayerKeyInput[CVars.sy_maxKeyboards.intValue];
            }

            PlayerKeyInput input = keyboardInputs[index];

            if (input == null)
            {
                input = new PlayerKeyInput();
                keyboardInputs[index] = InitKeyboardInput(index, input);
            }

            return(input);
        }