Guest User

Untitled

a guest
Apr 19th, 2018
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.10 KB | None | 0 0
  1. IEnumerator FireMainGun()
  2.  
  3. {
  4.  
  5. shooted = true;
  6.  
  7. //Отвечает за разброс
  8.  
  9.  
  10.  
  11. randomNumberX = rnd.Next(-strayFactor, strayFactor);
  12.  
  13. randomNumberY = rnd.Next(-strayFactor, strayFactor);
  14.  
  15. randomNumberZ = rnd.Next(-strayFactor, strayFactor);
  16.  
  17.  
  18.  
  19. //Поворачиваем на этот вектор
  20.  
  21. instantiatedProjectile.transform.Rotate(randomNumberX, randomNumberY, randomNumberZ);
  22.  
  23.  
  24.  
  25. audio.PlayOneShot(ShootAudio);
  26.  
  27. Instantiate(GunParticle, GunParticleObject.transform.position, GunParticleObject.transform.rotation);
  28.  
  29. //Instantiate(MuzzleSmoke, GunParticleObject.transform.position, GunParticleObject.transform.rotation);
  30.  
  31. instantiatedProjectile = (GameObject)Instantiate(mainGunProjectile, GunParticleObject.transform.position, GunParticleObject.transform.rotation);
  32.  
  33. instantiatedProjectile.rigidbody.velocity = gunMuzzlePoint.transform.TransformDirection(new Vector3(0, 0, 150.0f));
  34.  
  35.  
  36.  
  37.  
  38.  
  39.  
  40.  
  41. yield return new WaitForSeconds(SpeedShoot);
  42.  
  43. shooted = false;
  44.  
  45.  
  46.  
  47. }
Add Comment
Please, Sign In to add comment