/// <summary> /// Input abstraction for easier asset updates using outside control schemes. /// </summary> private void Inputs() { try { inputAttackL = rpgInputs.RPGCharacter.AttackL.WasPressedThisFrame(); inputAttackR = rpgInputs.RPGCharacter.AttackR.WasPressedThisFrame(); inputBlock = rpgInputs.RPGCharacter.Block.IsPressed(); inputCastL = rpgInputs.RPGCharacter.CastL.WasPressedThisFrame(); inputCastR = rpgInputs.RPGCharacter.CastR.WasPressedThisFrame(); inputDeath = rpgInputs.RPGCharacter.Death.WasPressedThisFrame(); inputFace = rpgInputs.RPGCharacter.Face.IsPressed(); inputFacing = rpgInputs.RPGCharacter.Facing.ReadValue <Vector2>(); inputJump = rpgInputs.RPGCharacter.Jump.WasPressedThisFrame(); inputLightHit = rpgInputs.RPGCharacter.LightHit.WasPressedThisFrame(); inputMovement = rpgInputs.RPGCharacter.Move.ReadValue <Vector2>(); inputRelax = rpgInputs.RPGCharacter.Relax.WasPressedThisFrame(); inputRoll = rpgInputs.RPGCharacter.Roll.WasPressedThisFrame(); inputShield = rpgInputs.RPGCharacter.Shield.WasPressedThisFrame(); inputAim = rpgInputs.RPGCharacter.Aim.IsPressed(); inputSwitchDown = rpgInputs.RPGCharacter.WeaponDown.WasPressedThisFrame(); inputSwitchLeft = rpgInputs.RPGCharacter.WeaponLeft.WasPressedThisFrame(); inputSwitchRight = rpgInputs.RPGCharacter.WeaponRight.WasPressedThisFrame(); inputSwitchUp = rpgInputs.RPGCharacter.WeaponUp.WasPressedThisFrame(); // Injury toggle. if (Keyboard.current.iKey.wasPressedThisFrame) { if (rpgCharacterController.CanStartAction("Injure")) { rpgCharacterController.StartAction("Injure"); } else if (rpgCharacterController.CanEndAction("Injure")) { rpgCharacterController.EndAction("Injure"); } } // Headlook toggle. if (Keyboard.current.lKey.wasPressedThisFrame) { rpgCharacterController.ToggleHeadlook(); } // Slow time toggle. if (Keyboard.current.tKey.wasPressedThisFrame) { if (rpgCharacterController.CanStartAction("SlowTime")) { rpgCharacterController.StartAction("SlowTime", 0.125f); } else if (rpgCharacterController.CanEndAction("SlowTime")) { rpgCharacterController.EndAction("SlowTime"); } } // Pause toggle. if (Keyboard.current.pKey.wasPressedThisFrame) { if (rpgCharacterController.CanStartAction("SlowTime")) { rpgCharacterController.StartAction("SlowTime", 0f); } else if (rpgCharacterController.CanEndAction("SlowTime")) { rpgCharacterController.EndAction("SlowTime"); } } } catch (System.Exception) { Debug.LogError("Inputs not found! Character must have Player Input component."); } }
/// <summary> /// Input abstraction for easier asset updates using outside control schemes. /// </summary> private void Inputs() { try { inputJump = Input.GetButtonDown("Jump"); isJumpHeld = Input.GetButton("Jump"); inputLightHit = Input.GetButtonDown("LightHit"); inputDeath = Input.GetButtonDown("Death"); inputAttackL = Input.GetButtonDown("AttackL"); inputAttackR = Input.GetButtonDown("AttackR"); inputCastL = Input.GetButtonDown("CastL"); inputCastR = Input.GetButtonDown("CastR"); inputSwitchUpDown = Input.GetAxisRaw("SwitchUpDown"); inputSwitchLeftRight = Input.GetAxisRaw("SwitchLeftRight"); inputAimBlock = Input.GetAxisRaw("Aim"); inputAiming = Input.GetButton("Aiming"); inputHorizontal = Input.GetAxisRaw("Horizontal"); inputVertical = Input.GetAxisRaw("Vertical"); inputFace = Input.GetMouseButton(1); inputFacingHorizontal = Input.GetAxisRaw("FacingHorizontal"); inputFacingVertical = Input.GetAxisRaw("FacingVertical"); inputRoll = Input.GetButtonDown("L3"); inputShield = Input.GetButtonDown("Shield"); inputRelax = Input.GetButtonDown("Relax"); // Injury toggle. if (Input.GetKeyDown(KeyCode.I)) { if (rpgCharacterController.CanStartAction("Injure")) { rpgCharacterController.StartAction("Injure"); } else if (rpgCharacterController.CanEndAction("Injure")) { rpgCharacterController.EndAction("Injure"); } } // Headlook toggle. if (Input.GetKeyDown(KeyCode.L)) { rpgCharacterController.ToggleHeadlook(); } // Slow time toggle. if (Input.GetKeyDown(KeyCode.T)) { if (rpgCharacterController.CanStartAction("SlowTime")) { rpgCharacterController.StartAction("SlowTime", 0.125f); } else if (rpgCharacterController.CanEndAction("SlowTime")) { rpgCharacterController.EndAction("SlowTime"); } } // Pause toggle. if (Input.GetKeyDown(KeyCode.P)) { if (rpgCharacterController.CanStartAction("SlowTime")) { rpgCharacterController.StartAction("SlowTime", 0f); } else if (rpgCharacterController.CanEndAction("SlowTime")) { rpgCharacterController.EndAction("SlowTime"); } } } catch (System.Exception) { Debug.LogError("Inputs not found!"); } }