Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- 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);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement