-
-
Save kihira/5c2af37b8dc17def1981 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
private bool gunButtonDown; | |
public float fireRate; | |
private float fireTime; | |
void Update() | |
{ | |
// Only fire if button is down | |
if (gunButtonDown && Time.time > nextFire) | |
{ | |
GunFire(); | |
nextFire = Time.time + fireRate; | |
} | |
} | |
public void GunButtonDown() | |
{ | |
gunButtonDown = true; | |
} | |
public void GunButtonUp() | |
{ | |
gunButtonDown = false; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment