Added randomized reload time

This commit is contained in:
Gregory Campbell
2020-07-11 15:00:26 -04:00
parent c1efe59c11
commit 6faf425d06
3 changed files with 208 additions and 244 deletions
+2 -3
View File
@@ -11,7 +11,7 @@ public class PlayerScript : MonoBehaviour
private int life = 3;
private float translation;
private float rotation;
private float nextFire = 0.5f;
private float nextFire = 0.0f;
private float myTime = 0.0f;
private GameObject reloaded;
private Rigidbody2D rb;
@@ -35,9 +35,8 @@ public class PlayerScript : MonoBehaviour
if(Input.GetButton("Fire1") && myTime > nextFire)
{
nextFire = myTime + 0.5f;
GunFire();
nextFire = nextFire - myTime;
nextFire = Random.Range(0.0f, 2.0f);
myTime = 0.0f;
}