I have a gun that has many different features of shooting but I can not seem to find out how and where to fix so I can see how much ammo and bullets I have left.
I need a simple GUIText and nothing else but from what I have tried I just could not figure out where and how.
I hope any of you could help me.
Thanks
PS. This is not my personal script.
This is a part of the script.
void MachineGun_Fire(){
if (bulletsLeft <= 0)
{
StartCoroutine("reload");
return;
}
// If there is more than one bullet between the last and this frame
// Reset the nextFireTime
if (Time.time - fireRate > nextFireTime)
nextFireTime = Time.time - Time.deltaTime;
// Keep firing until we used up the fire time
while (nextFireTime < Time.time)
{
switch (typeOfBullet)
{
case BulletType.Physical:
StartCoroutine("FireOneShot"); // fire a physical bullet
break;
case BulletType.Raycast:
StartCoroutine("FireOneRay"); // fire a raycast.... change to FireOneRay
break;
default:
Debug.Log("error in bullet type");
break;
}
shotsFired++;
bulletsLeft--;
nextFireTime += fireRate;
EjectShell();
Kick();
}
}