private void PrintGamepadInfo(bool fullInfo) { print("Joysitck connected: " + JCS_Input.IsJoystickConnected()); if (!fullInfo) { return; } for (int index = 0; index < Input.GetJoystickNames().Length; ++index) { print("Index[" + index + "] => [" + Input.GetJoystickNames()[index] + "]"); } }
/* Setter/Getter */ /* Functions */ private void Update() { if (JCS_Input.GetKeyDown(KeyCode.A)) { JCS_SoundManager.instance.SwitchBackgroundMusic(mBGM_01, 0.5f, 0.5f); } if (JCS_Input.GetKeyDown(KeyCode.S)) { JCS_SoundManager.instance.SwitchBackgroundMusic(mBGM_02, 0.5f, 0.5f); } if (JCS_Input.GetKeyDown(KeyCode.D)) { JCS_SoundManager.instance.PlayOneShotBackgroundMusic(mOneShotBGM, mOnStackBGM); } }
/* Variables */ /* Setter/Getter */ /* Functions */ protected override void Update() { base.Update(); if (JCS_Input.GetKeyDown(KeyCode.LeftAlt) || JCS_Input.GetKeyDown(KeyCode.RightAlt)) { Jump(); } if (JCS_Input.GetKey(KeyCode.UpArrow)) { ClimbOrTeleport(); } if (JCS_Input.GetKey(KeyCode.Space)) { Attack(); } else if (JCS_Input.GetKey(KeyCode.RightArrow)) { MoveRight(); } else if (JCS_Input.GetKey(KeyCode.LeftArrow)) { MoveLeft(); } else if (JCS_Input.GetKey(KeyCode.DownArrow)) { Prone(); } if (JCS_Input.GetKeyDown(KeyCode.H)) { Hit(); } }
private void PCInput() { switch (mControlIndex) { // player 1 case 0: { if (JCS_Input.GetKey(KeyCode.W)) { Jump(); } if (JCS_Input.GetKeyDown(KeyCode.E)) { ToggleWait(); } } break; // player 2 case 1: { if (JCS_Input.GetKey(KeyCode.UpArrow)) { Jump(); } if (JCS_Input.GetKeyDown(KeyCode.RightControl)) { ToggleWait(); } } break; // player 3 case 2: { if (JCS_Input.GetKey(KeyCode.I)) { Jump(); } if (JCS_Input.GetKeyDown(KeyCode.O)) { ToggleWait(); } } break; // player 4 case 3: { if (JCS_Input.GetKey(KeyCode.Keypad8)) { Jump(); } if (JCS_Input.GetKeyDown(KeyCode.Keypad9)) { ToggleWait(); } } break; } MoveRight(); if (JCS_Input.GetKeyDown(KeyCode.P)) { JCS_SceneManager.instance.LoadScene("RC_LogoScene"); } }
/* Setter & Getter */ /* Functions */ private void Update() { PrintGamepadInfo(false); switch (JCS_InputSettings.instance.TargetGamePad) { case JCS_GamePadType.PS4: { /* Stick test. */ if (valueKeyTest) { float val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_RIGHT_X); print("Stick right X: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_RIGHT_Y); print("Stick right Y: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_LEFT_X); print("Stick left X: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_LEFT_Y); print("Stick left Y: " + val); } if (JCS_Input.GetJoystickKeyDown(0, JCS_JoystickButton.BUTTON_A)) { print("Joystick button Cir"); } if (JCS_Input.GetJoystickKeyDown(0, JCS_JoystickButton.BUTTON_B)) { print("Joystick button Sqr"); } if (JCS_Input.GetJoystickKeyUp(0, JCS_JoystickButton.BUTTON_X)) { print("Joystick button X"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_Y)) { print("Joystick button Tri"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.LEFT_TRIGGER)) { print("Left Trigger down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.RIGHT_TRIGGER)) { print("Right Trigger down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.LEFT_BUMPER)) { print("Left BUMPER down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.RIGHT_BUMPER)) { print("Right BUMPER down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.START_BUTTON)) { print("Options down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BACK_BUTTON)) { print("Share down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_RIGHT)) { print("Joystick button RIGHT"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_LEFT)) { print("Joystick button LEFT"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_UP)) { print("Joystick button UP"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_DOWN)) { print("Joystick button DOWN"); } } break; case JCS_GamePadType.XBOX_360: { /* Stick test. */ if (valueKeyTest) { float val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_RIGHT_X); print("Stick right X: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_RIGHT_Y); print("Stick right Y: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_LEFT_X); print("Stick left X: " + val); val = JCS_Input.GetAxis(0, JCS_JoystickButton.STICK_LEFT_Y); print("Stick left Y: " + val); } if (JCS_Input.GetJoystickKeyDown(0, JCS_JoystickButton.BUTTON_A)) { print("Joystick button A"); } if (JCS_Input.GetJoystickKeyDown(0, JCS_JoystickButton.BUTTON_B)) { print("Joystick button B"); } if (JCS_Input.GetJoystickKeyUp(0, JCS_JoystickButton.BUTTON_X)) { print("Joystick button X"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_Y)) { print("Joystick button Y"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_RIGHT)) { print("Joystick button RIGHT"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_LEFT)) { print("Joystick button LEFT"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_UP)) { print("Joystick button UP"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BUTTON_DOWN)) { print("Joystick button DOWN"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.HOME_BUTTON)) { print("Joystick button HOME"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.START_BUTTON)) { print("Joystick button START"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.BACK_BUTTON)) { print("Joystick button BACK"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.LEFT_BUMPER)) { print("Left BUMPER down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.RIGHT_BUMPER)) { print("Right BUMPER down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.LEFT_TRIGGER)) { print("Right trigger down"); } if (JCS_Input.GetJoystickButton(0, JCS_JoystickButton.RIGHT_TRIGGER)) { print("Left trigger down"); } if (JCS_Input.GetKeyDown(KeyCode.Joystick1Button0)) { print(KeyCode.Joystick1Button0); } } break; } }