public float 枪械子弹角度 = 0f;
public float 枪械子弹最大角度 = 180f;
public Vector3 获取射击方向范围角度面积(Transform 射击位置) => Vector3.Slerp(射击位置.forward, Random.insideUnitSphere, 枪械属性.枪械子弹角度 / 枪械属性.枪械子弹最大角度);
private void 创建子弹()
{
for (int i = 0; i < 子弹数量; i++)
{
GameObject 子弹物体 = Instantiate(子弹物体, 枪口位置.position, Quaternion.LookRotation(获取射击方向范围角度面积(枪口位置)));
}
}
//子弹挂载脚本
public float 子弹移动速度;
private void Update()
{
transform.position += Time.deltaTime * 子弹移动速度 * transform.forward;
}