Hello,
I have a script for a gun wich works fine, but i want to make it that the gun has a firerate like 500 Bullets per Minute.
using UnityEngine;
using System.Collections;
public class Assault : MonoBehaviour {
public AudioClip ShootingSound;
public AudioClip Hitmarker;
public int Damage;
public float Cooldown;
public float CooldownRemaining;
public GameObject Spark;
Enemy Enemy;
// Use this for initialization
void Start () {
}
// Update is called once per frame
void Update () {
RaycastHit rayHit;
Ray ray = new Ray (transform.position + transform.forward * 0.4f, transform.forward);
CooldownRemaining -= Time.deltaTime;
if (Input.GetButton ("Fire1") && CooldownRemaining <= 0) {
CooldownRemaining = Cooldown;
This is not all of the Script but i think you dont need more?
PS: I know the Cooldown works fine but i want to have the firerate to be set easiely.