public static XY[] Ring(XY dir, int bullets) { float step = Mathf.PI * 2 / bullets; var arr = new XY [bullets]; for (int i = 0; i < bullets; i++) { arr[i] = dir.Rotated(step * i); } return(arr); }
public static XY[] Spray(XY dir, float cone, int bullets) { if (bullets == 1) { return new[] { dir } } ; var arr = new XY [bullets]; float step = cone / (bullets - 1); float half = cone * 0.5f; for (int i = 0; i < bullets; i++) { arr[i] = dir.Rotated(step * i - half); } return(arr); }