Как лучше реализовать дробь в Unity?

Создаю проект по подобию Duck Game. Дошёл до момента реализации разного вида оружия. Нужно сделать разброс дроби(предположим 3 пули) в разные под разным углом. Хотел реализовать через прибавления к transform.rotation, но выдаёт ошибку. Как будет лучше поступить?

КОД ОРУЖИЯ

using UnityEngine;

public class Gun : MonoBehaviour
{
    public float offset;
    public GameObject Bullet;
    public Transform shootPoint;
    private float timeBS;
    public float StartTime;
    void Start()
    {
        
    }

    // Update is called once per frame
    void Update()
    {
        Vector3 difference = Camera.main.ScreenToWorldPoint(Input.mousePosition)-transform.position;
        float rotz = Mathf.Atan2(difference.y,difference.x)*Mathf.Rad2Deg;
        transform.rotation = Quaternion.Euler(0f,0f, rotz+ offset);
        if(timeBS<=0){
            if(Input.GetMouseButton(0)){
                Instantiate(Bullet,shootPoint.position, transform.rotation);
                timeBS = StartTime;
        }  
        }
        else{
            timeBS -= Time.deltaTime;
        }
 
    }
}

Код Пули

using UnityEngine;

public class Bullet : MonoBehaviour
{
    public float speed;
    public float life;
    public float dist;
    public int damage;
    public LayerMask ground;
    private void Start() {
        Invoke("DesctroyProjectile",life);
    }
    private void Update() {
        RaycastHit2D hit = Physics2D.Raycast(transform.position, transform.right, dist, ground);
        if(hit.collider != null){
            if(hit.collider.CompareTag("Enemy")){
                hit.collider.GetComponent<Enemy>().TakeDamage(damage);
            }
            Destroy(gameObject);
        }
        transform.Translate(Vector2.right* speed* Time.deltaTime);
    }
    void Destroy(){
        Instantiate(null,transform.position, Quaternion.identity);
        Destroy(gameObject);
    }
}

что-то такое хотелось бы получить


Ответы (0 шт):