Advertisement
kadyr

Untitled

Oct 16th, 2021
216
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.65 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class Shotgun:Gun
  4. {
  5. void Start()
  6. {
  7. damage = 5;
  8. auto = false;
  9. coolDown = 0f;
  10. speed = 0.1f;
  11. }
  12. protected override void OnShoot()
  13. {
  14. for (int i = 0; i < 10; i++)
  15. {
  16. GameObject buf = Instantiate(bullet);
  17. buf.transform.position = riffleStart.transform.position;
  18. float x = Random.Range(-30, 30);
  19. float y = Random.Range(-10, 10);
  20. buf.transform.rotation = transform.rotation;
  21. buf.GetComponent<Bullet>().setDirection(transform.forward + new Vector3(x / 500, y / 500, 0));
  22. }
  23. }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement