public void PlayerUpdate() { if (controllerInput.GetStartButtonDown()) { gameManager.PauseGame(isPlayerOne); } if (action == Action.Neutral || action == Action.Attacking) //Attacks managed here { if (controllerInput.GetLeftActionButtonDown()) { attackManager.Punch(stance); } else if (controllerInput.GetBottomActionButtonDown() && !delayFrame) //Same button as resuming from pause menu so wait a frame { attackManager.Kick(stance); } else if (controllerInput.GetTopActionButtonDown()) { attackManager.RangedAttack(stance); } if (stance == Stance.Standing) { if (controllerInput.GetLeftBumperDown()) { attackManager.Taunt(); } else if (!controllerInput.GetRightBumper() && controllerInput.GetRightActionButtonDown()) { attackManager.SpecialAttack(); } else if (controllerInput.GetRightBumper() && controllerInput.GetRightActionButtonDown()) { attackManager.Ultimate(); } } attackManager.PerformComboAttackIfQueued(); } if (action != Action.Recovering && action != Action.Attacking && stance != Stance.KnockedDown) { Vector3 velocity = new Vector3(0f, rb.velocity.y); if (stance == Stance.Jumping) { velocity.x = rb.velocity.x; } else if (stance == Stance.Standing || stance == Stance.Crouching) //Blocking, moving, and crouching inputs { if (controllerInput.GetXAxisLeft()) //Movement { velocity.x -= moveSpeed; anim.SetFloat("direction", -1f); if (!anim.GetBool("walking")) { anim.Play("Walk", 0, float.NegativeInfinity); } } else if (controllerInput.GetXAxisRight()) { velocity.x += moveSpeed; anim.SetFloat("direction", 1f); if (!anim.GetBool("walking")) { anim.Play("Walk"); } } if (action == Action.Blocking) { if (!(controllerInput.GetLeftTrigger() || controllerInput.GetRightTrigger())) { anim.Play("Unblock"); } } else { if (controllerInput.GetLeftTrigger() || controllerInput.GetRightTrigger()) { anim.Play("Block"); action = Action.Recovering; } } if (action != Action.Attacking) { if (stance == Stance.Crouching) { if (!controllerInput.GetYAxisDown()) { anim.Play("Uncrouch"); } } else { if (controllerInput.GetYAxisDown()) { anim.Play("Crouch"); } } } } if (stance == Stance.Standing && action == Action.Neutral) { if (controllerInput.GetYAxisUp()) { invincible = false; stance = Stance.Jumping; velocity.y = 2f; //Add jumping animation } } if (!gameManager.AbleToMoveForward() && //Prevent player from moving past other player ((isPlayerOne && velocity.x > 0f) || (!isPlayerOne && velocity.x < 0f))) { velocity.x = 0f; } rb.velocity = velocity; if (velocity.x == 0f) { anim.SetBool("walking", false); } else { anim.SetBool("walking", true); } } else if (attackMoving) { rb.velocity = attackingVelocity; } else if (stance == Stance.KnockedDown && action != Action.Recovering) { if (controllerInput.GetYAxisUp()) { GetUp(); } } if (inHitFrame) { CheckForHit(); } }