Gun.cs 350 B

12345678910111213141516171819202122
  1. using UnityEngine;
  2. public class Gun : MonoBehaviour
  3. {
  4. public GameObject bulletPrefab;
  5. public Transform spawnPoint;
  6. void Start()
  7. {
  8. }
  9. void Update()
  10. {
  11. }
  12. public void Shoot()
  13. {
  14. if (GameManager.gameManager.gameRunning)Instantiate(bulletPrefab, spawnPoint.position, spawnPoint.rotation);
  15. }
  16. }