(サンプルコード)
using UnityEngine;
public class Fire : MonoBehaviour
{
// ★インプットシステム
private InputSystem_Actions isa;
public GameObject beamPrefab;
private int count;
public AudioClip sound;
private void Start()
{
// ★インプットシステム
isa = new InputSystem_Actions();
isa.Enable();
}
private void FixedUpdate()
{
// ★インプットシステム
if (isa.Player.Attack.IsPressed()) // エンターキーを押している時(ポイント)
{
count += 1;
if (count % 5 == 0)
{
Instantiate(beamPrefab, transform.position, Quaternion.identity);
AudioSource.PlayClipAtPoint(sound, transform.position);
}
}
}
}
(実行確認)
・エンターキーを押し続けると連射モード発動で成功