Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #pragma strict
- var weapon : GameObject;
- var bullet : GameObject;
- var maxWeaponTimeout : int = 25;
- private var weaponTimeout : int = 0;
- var singleshoot : int = 1;
- function Update () {
- if (weaponTimeout == 0) {
- if (singleshoot == 0) {
- if (Input.GetMouseButton(0)) {
- weapon.animation.Play("shoot");
- Instantiate(bullet);
- weaponTimeout = maxWeaponTimeout;
- }
- } else {
- if (Input.GetMouseButtonDown(0)) {
- weapon.animation.Play("shoot");
- Instantiate(bullet);
- weaponTimeout = maxWeaponTimeout;
- }
- }
- } else {
- weaponTimeout--;
- if (weaponTimeout <= -1) {
- Debug.Log("weaponTimeout is negative");
- Application.Quit();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement