void Update() { #if UNITY_ANDROID || UNITY_IOS if (SettingsManager.MobileControl == MobileControlMode.Tilt) { holdFly = Input.GetMouseButton(0); accelerationX = Input.acceleration.x; } else { if (accelerationX != 0) { accelerationX = 0; } holdFly = MobileInputManager.GetAxis("Vertical") == 1; axisHorizontal = MobileInputManager.GetAxis("Horizontal"); } #else holdFly = Input.GetButton("Fly") || Input.GetAxisRaw("Vertical") == 1; axisHorizontal = Input.GetAxis("Horizontal"); #endif TurnJetpack(holdFly); Vector3 scale = transform.localScale; if (rb2d.velocity.normalized.x > 0) { scale.x = 1; } else if (rb2d.velocity.normalized.x < 0) { scale.x = -1; } transform.localScale = scale; transform.rotation = Quaternion.Euler(0, 0, -(rb2d.velocity.x * 3)); audioSource.mute = !holdFly || !enabled; if (Input.GetButtonDown("Cancel")) { if (StageManager.Instance.IsPaused) { StageManager.Instance.Resume(); } else { StageManager.Instance.Pause(); } } Vector2 center = new Vector2(transform.position.x, coll.bounds.min.y); RaycastHit2D grounded = Physics2D.BoxCast(center, groundCheckSize, 0, Vector2.down, 0, groundLayer); Anim.SetBool("flying", !grounded); }
private void Update() { axisText.text = string.Format("Axis: {0}", MobileInputManager.GetAxis("Horizontal")); }