Advertisement
Guest User

Untitled

a guest
May 21st, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.50 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class Shooting : MonoBehaviour {
  6.  
  7. public float ShootCooldown;
  8. public float CooldownCounter;
  9.  
  10. public bool CanShoot;
  11.  
  12. void Start () {
  13. CanShoot = true;
  14. }
  15.  
  16. void Update () {
  17.  
  18. if (Input.GetKeyDown (KeyCode.Mouse0) && CanShoot) {
  19. CanShoot = false;
  20. StartCoroutine (CanShootAgain ());
  21. }
  22. }
  23.  
  24. IEnumerator CanShootAgain (){
  25. yield return new WaitForSeconds (1);
  26. CanShoot = true;
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement