private void Jump() { //Play sound if able to jump //if (_normalJump || ((_touchingWallLeft || _touchingWallRight) && _wallJump)) if (_normalJump) { _sound.playSound("jump"); _rigidbody.velocity = new Vector2(_rigidbody.velocity.x, Jump_Force); _normalJump = false; return; } if (_touchingWallLeft && _wallJump) { _sound.playSound("wallJump"); _rigidbody.velocity = new Vector2(_rigidbody.velocity.x, Jump_Force); _wallJump = false; _animator.SetFloat("Walljumps", 0); return; } if (_touchingWallRight && _wallJump) { _sound.playSound("wallJump"); _rigidbody.velocity = new Vector2(_rigidbody.velocity.x, Jump_Force); _wallJump = false; _animator.SetFloat("Walljumps", 0); return; } }
public void Shoot() { //Controls for mouse //Vector3 direction = Input.mousePosition - _cam.WorldToScreenPoint(_holder.position); //float angle = Mathf.Atan2(direction.y, direction.x) * 360 / (2 * Mathf.PI); //Controls for controller float xaxis = Input.GetAxisRaw("AimX_p" + _player); float yaxis = Input.GetAxisRaw("AimY_p" + _player); float angle = Mathf.Atan2(yaxis, xaxis) * 360 / (2 * Mathf.PI); Quaternion rotationa = Quaternion.Euler(0, 0, angle - 20); Quaternion rotationb = Quaternion.Euler(0, 0, angle); Quaternion rotationc = Quaternion.Euler(0, 0, angle + 20); GameObject bulleta = Instantiate(BulletPrefab, _holder.position, rotationa); GameObject bulletb = Instantiate(BulletPrefab, _holder.position, rotationb); GameObject bulletc = Instantiate(BulletPrefab, _holder.position, rotationc); //Play shoot SFX _sound.playSound("shoot"); }