// Update is called once per frame private void Update() { hVal = Input.GetAxis("Horizontal"); if (hVal != 0F) { transform.Translate(transform.right * movementSpeed * hVal * Time.deltaTime, Space.World); } if (Input.GetKeyDown(KeyCode.Alpha1)) { currentBullet = redBullet; } else if (Input.GetKeyDown(KeyCode.Alpha2)) { currentBullet = yellowBullet; } if (Input.GetKeyUp(KeyCode.Space) && canShoot) { Shoot(); } }
// Start is called before the first frame update private void Start() { currentBullet = redBullet; }