Quantcast
Channel: Unity Forum
Viewing all articles
Browse latest Browse all 1466670

How would I add a cool down time to my gun?

$
0
0
I don't know how to add one, can someone show me please?


Code (JavaScript):
  1. var projectile : Rigidbody;
  2. var speed = 20;
  3.  
  4. function Update () {
  5.  
  6. if ( Input.GetButton ("Fire1")) {
  7.  
  8. clone = Instantiate(projectile, transform.position, transform.rotation);
  9. clone.velocity = transform.TransformDirection( Vector3 (0, 0, speed));
  10.  
  11. Destroy (clone.gameObject, 3);
  12.  
  13. }}

Viewing all articles
Browse latest Browse all 1466670

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>