Unity 3d


Merhaba arkadaşlar burada Unity3d ile ilgili tüm kod bilgilerini sizlerle paylaşıcam

Animasyonlu Yapay Zeka
İndirme Linki  >   Animasyonlu Yapay Zeka.js - 2 KB
Silah Kodları
İndirme Linki > http://dosya.co/nsc4csyfqckw/Scripts_Package.zip.html
  1. #pragma strict
  2.  
  3. var projectile : GameObject;
  4. var fireRate : float = 0.1;
  5. private var nextFire : float = 0.0;
  6. var hasMuzzleFlash : boolean = true;
  7. var muzzleFlash : GameObject;
  8. var bulletsLeft : int = 5;
  9. private var hasFired : boolean = false;
  10. private var bulletsPerShot : float = 1;
  11.  
  12.  
  13. function Update () {
  14.  
  15. if(hasFired) {
  16. bulletsLeft -= bulletsPerShot;
  17. }
  18.  
  19.  
  20. if(Input.GetKey("space") && bulletsLeft <= 0) return;
  21.  
  22. if(Input.GetButton("Fire1") && Time.time > nextFire && bulletsLeft > 0) {
  23. nextFire = Time.time + fireRate;
  24. var clone = Instantiate (projectile, transform.position, transform.rotation);
  25. hasFired = true;
  26. }
  27.  
  28.  
  29. if(Input.GetKey("space")) return;
  30.  
  31. if(Input.GetButton("Fire1") && Time.time > nextFire) {
  32. nextFire = Time.time + fireRate;
  33. Instantiate (muzzleFlash, transform.position, transform.rotation);
  34. }
  35.  
  36. }

Hiç yorum yok:

Yorum Gönder