void Update() { // Store the input axes. h = XCI.GetAxis(XboxAxis.LeftStickX, joystick); v = XCI.GetAxis(XboxAxis.LeftStickY, joystick); // Set the input axes on the Animator Controller. anim.SetFloat(hFloat, h, 0.1f, Time.deltaTime); anim.SetFloat(vFloat, v, 0.1f, Time.deltaTime); // Toggle sprint by input. sprint = XCI.GetDPad(XboxDPad.Up, joystick); // Set the correct camera FOV for sprint mode. if (IsSprinting()) { changedFOV = true; camScript.SetFOV(sprintFOV); } else if (changedFOV) { camScript.ResetFOV(); changedFOV = false; } // Set the grounded test on the Animator Controller. anim.SetBool(groundedBool, IsGrounded()); if (IsGrounded()) { GetRigidBody.drag = 0; } }
protected override void Update() { if (this.SelectMyMode() == false || selectFace == true) { return; } // Controllerの左スティックのAxisを取得 LeftStickInput = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, controllerNumber), XCI.GetAxis(XboxAxis.LeftStickY, controllerNumber)); //LeftStickの入力がない時 if (LeftStickflag == false) { this.PushButton(); } else { //スッティックが中心近くまで戻っていたら if ((LeftStickInput.y < 0.1f && LeftStickInput.y > -0.1f) && (LeftStickInput.x < 0.1f && LeftStickInput.x > -0.1f)) { LeftStickflag = false; } } //プレイ人数を決定 if (Input.GetKeyDown(KeyCode.Space) || XCI.GetButtonDown(XboxButton.B, controllerNumber)) { //クリック音 audiosource.PlayOneShot(Click_clip); this.Decide(); } }
Vector2 GetAxis() { float x = XCI.GetAxis(XboxAxis.LeftStickX, playerID); float y = XCI.GetAxis(XboxAxis.LeftStickY, playerID); return(new Vector2(x, y).normalized); }
public void FlameShootingLeft() { // counter starts counting counter += Time.deltaTime; // checks if player is alive so they can shoot if (health.playerState == PlayerHealth.PlayerState.ALIVE) { // if player presses the left trigger if (XCI.GetAxis(XboxAxis.LeftTrigger, xboxController.controller) > 0.1f) { // sizzle will shoot her left gauntlet if (counter > delay) { // instantiates the flame at the newFlame = Instantiate(flameBallLeft, transform.position, sizzleRotation.transform.rotation); anim.SetBool("IsAttacking", true); audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(flameAudio); counter = 0.0f; } } else if (XCI.GetAxis(XboxAxis.LeftTrigger, xboxController.controller) < 0.1f) { anim.SetBool("IsAttacking", false); } } else if (health.playerState == PlayerHealth.PlayerState.REVIVE && health.playerState == PlayerHealth.PlayerState.DEAD) { xboxController.useController = false; } }
// Update is called once per fram void Update() { float xAxis = 0; float yAxis = 0; if (!UseKeyboard) { xAxis = XCI.GetAxis(XboxAxis.LeftStickX, CurrentController); yAxis = XCI.GetAxis(XboxAxis.LeftStickY, CurrentController); } else { xAxis = Input.GetAxis("Horizontal"); yAxis = Input.GetAxis("Vertical"); } if (!isControlDisabled) { if (!IsPush) { Movement(xAxis, yAxis); TiltRotation(xAxis, yAxis); Vector3 pos = Camera.main.WorldToViewportPoint(transform.position); pos.x = Mathf.Clamp(pos.x, CameraCournerPaddingMin, CameraCournerPaddingMax); pos.y = Mathf.Clamp(pos.y, CameraCournerPaddingMin, CameraCournerPaddingMax); Vector3 newxz = Camera.main.ViewportToWorldPoint(pos);; transform.position = new Vector3(newxz.x, transform.position.y, newxz.z); } } if (IsPush) { Push(); } }
// Atirar com a arma void Shoot() { // Tempo entre tiros if (timeToShoot > 0) { timeToShoot -= Time.deltaTime; timeToNextBullet -= Time.deltaTime; if (timeToNextBullet < 0 && bulletCount > 0) { shootSFX.Play(); var shot = Instantiate(bullet, transform.position, transform.rotation); shot.transform.Translate(bulletOffset); shot.GetComponent <Bullet>().SetParentName(stat.name); shot.GetComponentInChildren <MeshRenderer>().material.color = bulletColor; shot.GetComponent <Bullet>().stat = stat; bulletCount--; timeToNextBullet = bulletFrequency; } } // Atirar // O quanto o trigger direito foi apertado if (XCI.GetAxis(XboxAxis.RightTrigger, controller) > deadzone_trigger && timeToShoot <= 0) { shootSFX.Play(); var shot = Instantiate(bullet, transform.position, transform.rotation); shot.transform.Translate(bulletOffset); shot.GetComponent <Bullet>().SetParentName(stat.name); shot.GetComponentInChildren <MeshRenderer>().material.color = bulletColor; shot.GetComponent <Bullet>().stat = stat; timeToShoot = shotDelay; timeToNextBullet = bulletFrequency; bulletCount = bulletsToShoot - 1; } }
void Update() { forward = transform.right; decelerationTimer -= Time.deltaTime; if (myController.CanInput()) { accelerating = false; // getting direction for movement only if not charging if (!myController.IsStun()) { float x = XCI.GetAxis(XboxAxis.LeftStickX, myController.GetID()); float y = XCI.GetAxis(XboxAxis.LeftStickY, myController.GetID()); if (x != 0 || y != 0) { direction = (new Vector2(x, y)).normalized; // changing trajectory and accelerating only if not locking or charging moveForward = !CheckDrift() && !myController.IsCharging(); if (moveForward) { trajectory = direction; accelerating = true; } } } CheckSpeed(); } else { direction = forward; trajectory = forward; } }
// Update is used to set features regardless the active behaviour. void Update() { // Activate/deactivate aim by input. if (XCI.GetAxis(XboxAxis.LeftTrigger, joystick) != 0 && !aim) { StartCoroutine(ToggleAimOn()); } else if (aim && XCI.GetAxis(XboxAxis.LeftTrigger, joystick) == 0) { StartCoroutine(ToggleAimOff()); //moveScript.walkSpeed = 4; //moveScript.runSpeed = 4; } // No sprinting while aiming. canSprint = !aim; // Toggle camera aim position left or right, switching shoulders. if (aim && XCI.GetButton(XboxButton.LeftStick, joystick)) { aimCamOffset.x = aimCamOffset.x * (-1); aimPivotOffset.x = aimPivotOffset.x * (-1); } // Set aim boolean on the Animator Controller. behaviourManager.GetAnim.SetBool(aimBool, aim); }
// Update is called once per frame void Update() { inputVec = new Vector2(XCI.GetAxis(XboxAxis.LeftStickX, (XboxController)playerIndex), XCI.GetAxis(XboxAxis.LeftStickY, (XboxController)playerIndex)); if (XCI.GetButtonUp(XboxButton.LeftStick, (XboxController)playerIndex)) { Movement.initiateSneak(); } if (XCI.GetButton(XboxButton.A, (XboxController)playerIndex) && Movement.jumpStates != Movement.JUMPSTATES.JUMPING) { Movement.jumpStates = Movement.JUMPSTATES.JUMPPREP; Movement.jumpPreparation(); } if (XCI.GetButtonUp(XboxButton.A, (XboxController)playerIndex) && Movement.jumpStates != Movement.JUMPSTATES.JUMPING) { Movement.jumpStates = Movement.JUMPSTATES.LAUNCH; } if (XCI.GetButton(XboxButton.Y, (XboxController)playerIndex)) { GetComponent <Abilities>().triggerEnemies(); } }
// Update is called once per frame void Update() { if (thrustDrag < 0) { thrustDrag = 0; } if (rotateDrag < 0) { rotateDrag = 0; } rigidbody.drag = thrustDrag; rigidbody.angularDrag = rotateDrag; // Thrust forward or backward if (XCI.GetAxis(XboxAxis.LeftStickY) > 0.2f || Input.GetKey(KeyCode.W)) { rigidbody.AddRelativeForce(Vector3.forward * thrustSpeed * Time.deltaTime); } if (XCI.GetAxis(XboxAxis.LeftStickY) < -0.2f || Input.GetKey(KeyCode.S)) { rigidbody.AddRelativeForce(Vector3.forward * -thrustSpeed * 0.75f * Time.deltaTime); } // Turn clockwise or counterclockwise if (XCI.GetAxis(XboxAxis.RightStickX) > 0.2f || Input.GetKey(KeyCode.RightArrow)) { rigidbody.AddRelativeTorque(Vector3.up * rotateSpeed * Time.deltaTime); } if (XCI.GetAxis(XboxAxis.RightStickX) < -0.2f || Input.GetKey(KeyCode.LeftArrow)) { rigidbody.AddRelativeTorque(Vector3.up * -rotateSpeed * Time.deltaTime); } }
// Update is called once per frame void Update() { if (isActive) { if (!saved) { saved = true; saveElement(); } if (selected) { if (counter == 0) { float x = XCI.GetAxis(XboxAxis.LeftStickX, playerNum); if (x < 0) { update(false); } else if (x > 0) { update(true); } } // else if(counter == 5) // else { counter--; } } } }
// FixedUpdate is called once per physics step public void FixedUpdate() { if (!isDead && stunT==0 && !block && !casting) { // Cache the contoller input input. float rawHorizontal = XCI.GetAxis(XboxAxis.LeftStickX, controllerNum); float rawVertical = XCI.GetAxis(XboxAxis.LeftStickY, controllerNum); rawHorizontal = (rawHorizontal * 0.35f); Vector3 direction = new Vector3(rawHorizontal, 0f, rawVertical); float speed = (direction).magnitude; // Debug.Log ("Test speed: "+speed); if ((speed * rigidbody.velocity).magnitude < maxSpeed) rigidbody.AddForce(direction * moveForce); // if (rigidbody.velocity.magnitude > maxSpeed) // rigidbody.velocity = direction * maxSpeed; anim.SetFloat("Speed", speed * 5); if (rawHorizontal < 0 && facingRight) Flip(); else if (rawHorizontal > 0 && !facingRight) Flip(); } }
// Purpose: Handles the X & Y axis rotation for camera orbit around the player void Mouse_aiming() { // controller only atm: if (playerHandler.IsControllable) { if (playerHandler.HasAssignedController) { mouse_x = XCI.GetAxis(XboxAxis.RightStickX, playerHandler.AssignedController) * rotationSpeed; mouse_y = XCI.GetAxis(XboxAxis.RightStickY, playerHandler.AssignedController) * 1200.0f; } else { mouse_x = Input.GetAxis("Mouse X") * rotationSpeed; mouse_y = Input.GetAxis("Mouse Y") * 1200f; } } mouse_y = Mathf.Clamp(mouse_y, minY, maxY); // This keeps the Y-rotation between that angles to prevent full 360 degrees orbit in the Y-Axis rotation.x -= mouse_y * Time.deltaTime; rotation.y += mouse_x * Time.deltaTime; Quaternion localRotation = Quaternion.Euler(rotation.x, rotation.y, 0.0f); transform.position = player.transform.position + (localRotation * offset); }
void Update() { timer -= (timer > -1.0f ? Time.deltaTime * 5 : 0); if (timer <= 0 && IsResume) { this.gameObject.SetActive(false); } else if (timer <= 0 && IsMainMenu) { SceneManager.LoadScene(0); } if (button[0].GetComponent <buttonbehaviour>().isOn == false && button[1].GetComponent <buttonbehaviour>().isOn == false) { resume.GetComponent <buttonbehaviour>().isOn = true; currentButton = 0; } if (IsVertical) { if (XCI.GetAxis(XboxAxis.LeftStickY) < 0 && timer <= 0) { timer = 1.0f; currentButton++; } if (XCI.GetAxis(XboxAxis.LeftStickY) > 0 && timer <= 0) { timer = 1.0f; currentButton--; } } else { if (XCI.GetAxis(XboxAxis.LeftStickX) < 0 && timer <= 0) { timer = 1.0f; currentButton--; } if (XCI.GetAxis(XboxAxis.LeftStickX) > 0 && timer <= 0) { timer = 1.0f; currentButton++; } } currentButton = (currentButton > 1 ? 0 : (currentButton < 0 ? 0 : currentButton)); buttonBehaviours[0].isOn = (currentButton == 0 ? true : false); buttonBehaviours[1].isOn = (currentButton == 1 ? true : false); if (XCI.GetButtonDown(XboxButton.A) && timer <= 0) { timer = 1.0f; ButtonPressed(button[currentButton]); } }
private void Update() { if (playerHandler.IsControllable && !playerHandler.IsTestDummy) { float rightTrigHeight = XCI.GetAxis(XboxAxis.RightTrigger, playerHandler.AssignedController); if (Input.GetMouseButtonDown(0) || rightTrigHeight >= 0.5f) { if (readyToFire) { FireProjectile(); shotCount++; readyToFire = false; } } if (!readyToFire) { fireTimer += Time.deltaTime; if (fireTimer >= fireThreshold) { fireTimer = 0.0f; readyToFire = true; } } } }
private static float getAxisHelper(string playerTag, KeyCode kbKeyNeg, KeyCode kbKeyPos, float kbRange, XboxAxis ctrlrAxis) { Player player = playerFromTag(playerTag); // if the player is the keyboard player (and they're using the keyboard), // have that take precedence. if (player == KB_PLAYER) { bool kbIsNeg = Input.GetKey(kbKeyNeg); bool kbIsPos = Input.GetKey(kbKeyPos); if (kbIsNeg && kbIsPos) { return(0.0f); } else if (kbIsNeg && !kbIsPos) { return(-kbRange); } else if (!kbIsNeg && kbIsPos) { return(kbRange); } } // otherwise return the controller output return(XCI.GetAxis(ctrlrAxis, ctrlrFromPlayer(player))); }
void ActivateOnDetectJoystick() { if (HasDetected == false) { // Array values = Enum.GetValues(typeof(XboxButton)); foreach (XboxButton val in buttons) { if (XCI.GetButton(val, XboxController) == true) { HasDetected = true; Player.SetActive(true); _spawnEntity.FirstSpawn(); } } foreach (XboxAxis ax in sticks) { if (XCI.GetAxis(ax, XboxController) > 0 || XCI.GetAxis(ax, XboxController) < 0) { HasDetected = true; Player.SetActive(true); _spawnEntity.FirstSpawn(); } } } }
private void Update() { if (XCI.GetAxis(XboxAxis.RightTrigger, controller) > 0.1f && cooldown > .5f) { rb.AddForce(transform.forward * speed * cooldown); rb.AddRelativeTorque(-Vector3.up * rotation); cooldown = 0f; anim.Play("LeftRow"); } else if (XCI.GetAxis(XboxAxis.LeftTrigger, controller) > 0.1f && cooldown > .5f) { rb.AddForce(transform.forward * speed * cooldown); rb.AddRelativeTorque(Vector3.up * rotation); cooldown = 0f; anim.Play("RightRow"); } if (cooldown < 1.5f) { cooldown += Time.deltaTime; } var main = waterSpray.main; var emission = waterSpray.emission; main.startSpeed = rb.velocity.magnitude / 3; emission.rateOverTime = rb.velocity.magnitude * 20; transform.localEulerAngles = new Vector3(0, transform.localEulerAngles.y, 0); }
private void Update() { if (playerNumber != -1) { if (XCI.GetAxis(XboxAxis.LeftStickX, xboxController) < -0.2f) { if (canSwap) { Left(); } } else if (XCI.GetAxis(XboxAxis.LeftStickX, xboxController) > 0.2f) { if (canSwap) { Right(); } } if (XCI.GetButtonUp(XboxButton.A, xboxController)) { if (canConfirm) { CharacterSelection.instance.Confirm(playerNumber, activeChar, transform.position, xboxController); } } if (XCI.GetButtonUp(XboxButton.B, xboxController)) { canConfirm = false; characters[activeChar].gameObject.SetActive(false); //activeChar = 0; Commented out so that the previous choice of the player is remembered CharacterSelection.instance.Leave(playerNumber); playerNumber = 0; } } }
void Update() { float LT = XCI.GetAxis(XboxAxis.LeftTrigger, m_controller); if ((1.0f - LT) < 0.1f && !m_isUsingAbility && !mineAbilityCooldown.UnderMax()) { // animation for the door TetheredMineAnimation.SetBool("IsDoorOpen", true); TetheredMineAnimation.SetBool("IsDoorClosed", false); // Hatch Open Door Sound AudioManager.Play("TetherObs&BBHatchDoorOpen"); StartCoroutine(SpawnMine()); m_isUsingAbility = true; } if (!mineAbilityCooldown.UnderMax() && !m_mineabilityReady) { m_mineabilityReady = true; AudioManager.Play("BothPlaneCooldownAbiltysReady"); //Play the ability ready sound } else if (mineAbilityCooldown.UnderMax()) { m_mineabilityReady = false; } }
private void OnTriggerStay(Collider other) { if (other.tag == "Plant") { if (XCI.GetAxis(XboxAxis.RightTrigger) > 0.1f) { if (elementController.IsSelectedElementRain()) { // Debug.Log("X pressed"); // Check selected element controller other.GetComponent <Plant>().GiveWater(); } if (elementController.IsSelectedElementSunlight()) { // Check selected element controller other.GetComponent <Plant>().GiveSunlight(); } if (elementController.IsSelectedElementTime()) { // Check selected element controller if (other.GetComponent <Plant>().GetCanRespondToTime()) { plantManager.ChangePlantStage(other.gameObject); } } } } }
/// <summary> /// Updates Player 1's movement and facing rotation using the WASD keys and drops bombs using Space /// </summary> private void UpdatePlayerMovement() { if (XCI.GetAxis(XboxAxis.LeftStickY, controller) > 0) { //Up movement rigidBody.velocity = new Vector3(rigidBody.velocity.x, rigidBody.velocity.y, moveSpeed); myTransform.rotation = Quaternion.Euler(0, 0, 0); animator.SetBool("Walking", true); } if (XCI.GetAxis(XboxAxis.LeftStickX, controller) < 0) { //Left movement rigidBody.velocity = new Vector3(-moveSpeed, rigidBody.velocity.y, rigidBody.velocity.z); myTransform.rotation = Quaternion.Euler(0, 270, 0); animator.SetBool("Walking", true); } if (XCI.GetAxis(XboxAxis.LeftStickY, controller) < 0) { //Down movement rigidBody.velocity = new Vector3(rigidBody.velocity.x, rigidBody.velocity.y, -moveSpeed); myTransform.rotation = Quaternion.Euler(0, 180, 0); animator.SetBool("Walking", true); } if (XCI.GetAxis(XboxAxis.LeftStickX, controller) > 0) { //Right movement rigidBody.velocity = new Vector3(moveSpeed, rigidBody.velocity.y, rigidBody.velocity.z); myTransform.rotation = Quaternion.Euler(0, 90, 0); animator.SetBool("Walking", true); } if (canDropBombs && XCI.GetButtonDown(XboxButton.A, controller)) { //Drop bomb DropBomb(); } }
private void setMovement() { float speedX = XCI.GetAxis(XboxAxis.LeftStickX, playerNum) * Speed; float speedY = XCI.GetAxis(XboxAxis.LeftStickY, playerNum) * Speed; GetComponent <Rigidbody2D>().velocity = new Vector2(speedX, speedY); }
void Update() { playerController.Move(new Vector3(XCI.GetAxis(XboxAxis.LeftStickX, xbController), 0, XCI.GetAxis(XboxAxis.LeftStickY, xbController))); playerController.Aim(new Vector3(XCI.GetAxis(XboxAxis.RightStickX, xbController), 0, XCI.GetAxis(XboxAxis.RightStickY, xbController))); if (XCI.GetButtonDown(XboxButton.RightBumper, xbController)) { playerController.Attack(); } if (xbController == XboxController.First) { UpdatePlayer(0); } if (xbController == XboxController.Second) { UpdatePlayer(1); } if (xbController == XboxController.Third) { UpdatePlayer(2); } if (xbController == XboxController.Fourth) { UpdatePlayer(3); } }
/* * Handles rigid body movement and functional direction */ private void FixedUpdate() { // if the rigid body should use force to move if (m_useForce) { m_rigidBody.AddForce(m_movement * m_speed * 2, ForceMode.Acceleration); } else { m_rigidBody.MovePosition(m_rigidBody.position + (m_movement * Time.deltaTime * m_speed)); } // get the functional direction from right stick Vector3 functional = new Vector3(XCI.GetAxis(XboxAxis.RightStickX, m_controller), 0, XCI.GetAxis(XboxAxis.RightStickY, m_controller)); // if the right stick is being used if (functional.magnitude > 0) { m_rigidBody.rotation = Quaternion.LookRotation(functional.normalized); // rotate towards the functional direction } // else if the player is moving else if (m_movement.magnitude > 0) { m_rigidBody.rotation = Quaternion.LookRotation(m_movement.normalized); // rotate towards the movement direction } }
private void Drift() { //Drift Steering if (XCI.GetButton(XboxButton.X)) { driftbool = true; steer = 0; steer = -XCI.GetAxis(XboxAxis.LeftStickX, controller) * driftSteer; wheelColliders[1].steerAngle = steer; wheelColliders[2].steerAngle = steer; wheelColliders[0].steerAngle = 0; wheelColliders[3].steerAngle = 0; } else { driftbool = false; steer = 0; steer = XCI.GetAxis(XboxAxis.LeftStickX, controller) * maxSteer; wheelColliders[1].steerAngle = 0; wheelColliders[2].steerAngle = 0; wheelColliders[0].steerAngle = steer; wheelColliders[3].steerAngle = steer; } }
private void GetInput() { if (_IsUsingController) { _HorizontalAxis = XCI.GetAxis(XboxAxis.LeftStickX, controller); _VerticalAxis = XCI.GetAxis(XboxAxis.LeftStickY, controller); _LTrigger = 1 * XCI.GetAxis(XboxAxis.LeftTrigger, controller); _RTrigger = 1 * XCI.GetAxis(XboxAxis.RightTrigger, controller); _AButton = XCI.GetButton(XboxButton.A); _BButton = XCI.GetButton(XboxButton.B); _XButton = XCI.GetButton(XboxButton.X); _YButton = XCI.GetButton(XboxButton.Y); _DPadUp = XCI.GetButton(XboxButton.DPadUp); _DPadDown = XCI.GetButton(XboxButton.DPadDown); _DPadLeft = XCI.GetButton(XboxButton.DPadLeft); _DPadRight = XCI.GetButton(XboxButton.DPadRight); _BumperLeft = XCI.GetButton(XboxButton.LeftBumper); _BumperRight = XCI.GetButton(XboxButton.RightBumper); } if (_IsUsingController == false) { _RTrigger = Input.GetAxis("Vertical"); _HorizontalAxis = Input.GetAxis("Horizontal"); } }
private void Movement() { // Left stick movement Vector3 newPosition = transform.position; float axisX = XCI.GetAxis(XboxAxis.LeftStickX, controllerNumber); float axisY = XCI.GetAxis(XboxAxis.LeftStickY, controllerNumber); cc.Move(new Vector3(axisX * moveSpeed * Time.deltaTime, 0, axisY * moveSpeed * Time.deltaTime)); if (axisX != 0 || axisY != 0) { Vector3 targetRotation = new Vector3 { x = axisX, z = axisY }; bodyRotation = Vector3.Lerp(bodyRotation, targetRotation, 10 * Time.deltaTime); transform.LookAt(transform.position + bodyRotation); } // Right stick axisX = XCI.GetAxis(XboxAxis.RightStickX, controllerNumber); axisY = XCI.GetAxis(XboxAxis.RightStickY, controllerNumber); if (axisX != 0 || axisY != 0) { Vector3 targetRotation = new Vector3 { x = axisX, z = axisY }; turretRotation = Vector3.Lerp(turretRotation, targetRotation, 10 * Time.deltaTime); } turret.transform.LookAt(transform.position + turretRotation); }
void Update() { var moveDirection = new Vector3(XCI.GetAxis(XboxAxis.LeftStickX, controller), 0, XCI.GetAxis(XboxAxis.LeftStickY, controller)); _characterController.Move(moveDirection); // if a value exists if (XCI.GetAxis(XboxAxis.RightStickX, controller) != 0 || XCI.GetAxis(XboxAxis.RightStickY, controller) != 0) { _aimingDirection = new Vector3(XCI.GetAxis(XboxAxis.RightStickX, controller), 0, XCI.GetAxis(XboxAxis.RightStickY, controller)); } if (_inaccurate) { _characterDrunkController.Aim(_aimingDirection.normalized, _aimingDirection.normalized); } else { _characterController.Aim(_aimingDirection.normalized, _aimingDirection.normalized); } if (XCI.GetButtonDown(XboxButton.RightBumper, controller) || Input.GetMouseButtonDown(0)) { _characterController.Throw(); } if (XCI.GetButtonDown(XboxButton.LeftBumper, controller) || Input.GetMouseButtonDown(1)) { _characterController.Toss(); } }
public void FlameShootingRight() { if (health.playerState == PlayerHealth.PlayerState.ALIVE) { counter += Time.deltaTime; if (XCI.GetAxis(XboxAxis.RightTrigger, xboxController.controller) > 0.1f) { if (counter > delay) { GameObject newFlame = Instantiate(flameBallRight, transform.position, sizzleRotation.transform.rotation); anim.SetBool("IsAttacking", true); audioSource.pitch = Random.Range(minPitch, maxPitch); audioSource.PlayOneShot(flameAudio); counter = 0.0f; } } else if (XCI.GetAxis(XboxAxis.RightTrigger, xboxController.controller) < 0.1f) { anim.SetBool("IsAttacking", false); } } else if (health.playerState == PlayerHealth.PlayerState.REVIVE && health.playerState == PlayerHealth.PlayerState.DEAD) { xboxController.useController = false; } }