コード例 #1
0
    // 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();
        }
    }
コード例 #2
0
 // Start is called before the first frame update
 private void Start()
 {
     currentBullet = redBullet;
 }