void Update() { if (Input.GetKey(KeyCode.RightArrow) && gameObject.transform.position.x <= 5.6) { gameObject.transform.position += new Vector3(paddleSpeed * Time.deltaTime, 0, 0); if (ShouldBallFollow()) { BallControllor.Instance.transform.position += new Vector3(paddleSpeed * Time.deltaTime, 0, 0); } } if (Input.GetKey(KeyCode.LeftArrow) && gameObject.transform.position.x >= -5.6) { gameObject.transform.position -= new Vector3(paddleSpeed * Time.deltaTime, 0, 0); if (ShouldBallFollow()) { BallControllor.Instance.transform.position -= new Vector3(paddleSpeed * Time.deltaTime, 0, 0); } } if (InputControllor.GetPressedKey() == KeyCode.Return) { shootLaser = !shootLaser; } }
// Update is called once per frame private void Update() { if (target == null) { return; } KeyCode code = InputControllor.GetPressedKey(); if (code == KeyCode.Mouse0 || code == KeyCode.Return) { _directionOfMovement = -1 * _directionOfMovement; } transform.RotateAround(target.position, target.forward, _directionOfMovement * _speedWithoutInput * Time.deltaTime); }