void HandleInput() { if (Input.GetButton("Fire1")) { mGunMotor.Fire(); if (AudioManager.instance.getIsPlaying("PlayerFire") == false) { AudioManager.instance.playSound("PlayerFire"); } } if (Input.GetButtonUp("Fire1")) { if (AudioManager.instance.getIsPlaying("PlayerFire") == true) { AudioManager.instance.pauseSound("PlayerFire"); } } Vector3 mousePos = Camera.main.ScreenToWorldPoint(Input.mousePosition) + new Vector3(0, 0, 3); mousePos.x = Mathf.Clamp(mousePos.x, -3.8f, 3.8f); mousePos.y = Mathf.Clamp(mousePos.y, -4.7f, 4.8f); transform.position = mousePos; //Vector2 mouseVel = new Vector2(Input.GetAxis("Mouse X"), Input.GetAxis("Mouse Y")); //mRigidbody2D.velocity = mouseVel; }
void Update() { if (!mPaused) { if (mShouldBeFiring && mHealth.mCurrentHealth >= 0) { Aim(); mGunMotor.Fire(); } } }
void Update() { if (!mPaused) { if (mShouldBeFiring) { Aim(); mGunMotor.Fire(); } } }
public void Aim(Vector2 _leftStick, Vector2 _rightStick) { if (!parrying) { if (_rightStick != Vector2.zero) { SoftLock(_rightStick); transform.rotation = Quaternion.Euler(0, 0, facingDirection); mGunMotor.Fire(); } else if (_leftStick != Vector2.zero) { _leftStick.x = -_leftStick.x; facingDirection = Vector3.Angle(_leftStick, Vector2.up); if (_leftStick.x < 0) { facingDirection = -facingDirection; } transform.rotation = Quaternion.Euler(0, 0, facingDirection); } } }