Teachers open the door but You must enter by yourself.
【事前学習】前回学んだ機能を再確認しておきましょう。
using UnityEngine;
using UnityEngine.InputSystem;
public class PlayerController : MonoBehaviour
{
//途中省略
AudioSource a;
void Start(){
rb = GetComponent<Rigidbody>();
a = GetComponent<AudioSource>();
}
//途中省略
void OnFire(){
if (Time.time > nextFire){
nextFire = Time.time + fireRate;
Instantiate(shot,shotSpawn.position,shotSpawn.rotation);
a.Play();
}
}
//途中省略
}
【事後学習】本日学んだ機能を再確認しておきましょう。
This site is powered by