Advertisement
holllowknight

Создание нового орудия

Jul 11th, 2023
1,077
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.50 KB | None | 0 0
  1. using UnityEngine;
  2.  
  3. public class ShotGun : Weapon
  4. {
  5.     [SerializeField] private float _maxDeviation;
  6.     [SerializeField] private int _bulletNumber;
  7.  
  8.     public override void Shoot(Transform shootPoint)
  9.     {
  10.         for (int i = 0; i < _bulletNumber; i++)
  11.         {
  12.             float deviation = Random.Range(-_maxDeviation, _maxDeviation);
  13.             Quaternion rotation = Quaternion.Euler(0, 0, deviation);
  14.             Instantiate(Bullet, shootPoint.position, rotation);
  15.         }
  16.     }
  17. }
  18.  
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement