public void Shoot() { //var direction = (m_Camera.ScreenToWorldPoint(UnityEngine.Input.mousePosition).OnlyXY() - // m_CurrentWeapon.muzzle.position.OnlyXY()).normalized; var direction = (m_CurrentWeapon.muzzle.rotation * Vector2.right).OnlyXY().normalized; if (m_CurrentWeapon.CanShoot()) { _shootComponent.Shoot(direction); } }
// Update is called once per frame void Update() { float hInput = Input.GetAxis("Horizontal"); if (hInput != 0) { direction = (int)Mathf.Sign(hInput); } moveComponent.Move(hInput, moveComponent.MaxSpeed); if (Input.GetKeyDown(KeyCode.Space) && groundDetection.IsGrounded) { jumpComponent.Jump(jumpComponent.JumpForce); } if (Input.GetKeyDown(KeyCode.LeftControl)) { shootComponent.Shoot(direction); } }