void Update() { controllerInputY = Input.GetAxis("Vertical"); controllerInputX = Input.GetAxis("Horizontal"); DPadX = Input.GetAxis("DPadX"); //This is a band-aid. When I rework glide movement I will remove the X and Y animation parameters and replace it with a single "forward" parameter. playerAnim.SetFloat(HashTable.controllerXParam, controllerInputX); playerAnim.SetFloat(HashTable.controllerYParam, controllerInputY); //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- //LEFT STICK MOVEMENT if ((controllerInputX > .1f || controllerInputX < -.1f) || (controllerInputY > .1f || controllerInputY < -.1f)) { Movement?.Invoke(controllerInputX, controllerInputY); } else { MoveCancel?.Invoke(); } //JUMP/GLIDE INITIATION //User presses the jump input, they can be on the ground, in the air, or in the gliding state. if (Input.GetKeyDown("joystick button 0")) {//The 'A' Button if (playerAnim.GetCurrentAnimatorStateInfo(0).fullPathHash == HashTable.jumpState) { Glide?.Invoke(); } else {//Cant use switch statement because animation hashes aren't constant. if (playerAnim.GetCurrentAnimatorStateInfo(0).fullPathHash == HashTable.glideState) { GlideCancel?.Invoke(); } else { Jump?.Invoke(); } } } //INTERACT if (Input.GetKeyDown("joystick button 3")) { Interact?.Invoke(); } //DODGE ROLL if (Input.GetKeyDown("joystick button 1") && (playerAnim.GetAnimatorTransitionInfo(0).fullPathHash != HashTable.motionToDodge)) {//The B Button DodgeRoll?.Invoke(); } //GROUND ATTACKS if (Input.GetKeyDown("joystick button 2") && playerAnim.GetBool(HashTable.onGroundParam)) //This is for initiating a ground combo { //The 'X' Button GroundAttacks?.Invoke(); } //AIR ATTACKS if (!playerAnim.GetBool(HashTable.onGroundParam) && Input.GetKeyDown("joystick button 2")) //This is for initiating an air combo { //The 'X' Button AirAttacks?.Invoke(); } //CYCLE ITEMS FORWARD if (Mathf.Approximately(DPadX, 1f) && !alreadyDone) { alreadyDone = true; CycleItemsForward?.Invoke(); } if (Mathf.Approximately(DPadX, 0f) && alreadyDone) { alreadyDone = false; } //CYCLE ITEMS BACKWARD if (Mathf.Approximately(DPadX, -1f) && !alreadyDone) { alreadyDone = true; CycleItemsBackward?.Invoke(); } if (Mathf.Approximately(DPadX, 0f) && alreadyDone) { alreadyDone = false; } //ZOOM IN CAMERA if (Mathf.Approximately(Input.GetAxis("DPadY"), 1f)) {//DPad Y "Down" ZoomIn?.Invoke(); } //ZOOM OUT CAMERA if (Mathf.Approximately(Input.GetAxis("DPadY"), -1f)) {//DPad Y "Up" ZoomOut?.Invoke(); } //CHOOSE ITEM if (Input.GetKeyDown("joystick button 4")) {//Right Bumper if (playerAnim.GetCurrentAnimatorStateInfo(0).fullPathHash == HashTable.glideState) { GameManagerScript.instance.inputManager.GlideCancel(); } ChooseItem?.Invoke(); } //CAMERA TARGET MODE if (Input.GetKeyDown("joystick button 5")) {//Left Bumper CameraTargetMode?.Invoke(); } //----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- }