The errors I get: Screenshot - 0eacdb3c2e1cecc014d121aaebcc58c5 - Gyazo
Sorry if Iโm retarded!
using UnityEngine;
using System.Collections;
public class Gun : MonoBehaviour {
public enum FireMode{Auto, Burst, Single};
public FireMode fireMode;
public Transform muzzle;
public Projectile projectile;
public float msBetweenShots = 100;
public float muzzleVelocity = 35;
public float burstCount;
public Transform shell;
public Transform shellEjection;
Muzzleflash muzzleflash;
float nextShotTime;
bool triggerReleasedSinceLastShot;
int shotsRemainingInBurst;
void Start(){
muzzleflash = GetComponent<Muzzleflash>();
shotsRemainingInBurst = burstCount;
}
void Shoot(){
if(fireMode == FireMode.Burst){
if(shotsRemainingInBurst == 0){
return;
}
shotsRemainingInBurst --;
}
else if(fireMode = FireMode.Single){
if(!triggerReleasedSinceLastShot){
return;
}
}
if (Time.time > nextShotTime) {
nextShotTime = Time.time + msBetweenShots / 1000;
Projectile newProjectile = Instantiate (projectile, muzzle.position, muzzle.rotation)as Projectile;
newProjectile.SetSpeed (muzzleVelocity);
Instantiate(shell, shellEjection.position, shellEjection.rotation);
muzzleflash.Activate();
}
}
public void OnTriggerHold(){
Shoot ();
triggerReleasedSinceLastShot = false;
}
public void OnTriggerRelease(){
triggerReleasedSinceLastShot = true;
shotsRemainingInBurst = burstCount;
}
}