using System.Collections; using System.Collections.Generic; using UnityEngine; public class Blaster : MonoBehaviour { public float fireRate = 0.5f; public float fireCooldown = -1f; public GameObject bulletPrefab; void Update() { if (Input.GetMouseButtonDown(0) && Time.time > fireCooldown) { fireCooldown = Time.time + fireRate; Instantiate(bulletPrefab, transform.position, transform.rotation); } } }