mirror of
https://github.com/Xevion/procedural-placement.git
synced 2025-12-06 05:16:05 -06:00
move random sampling method into separate class, general cleanup, update .gitignore with less
This commit is contained in:
17
procedural-placement/Assets/PointGeneration.cs
Normal file
17
procedural-placement/Assets/PointGeneration.cs
Normal file
@@ -0,0 +1,17 @@
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class PointGeneration {
|
||||
public static List<Vector2> random_sampling(int numPoints, Vector2 range, Vector2 offset) {
|
||||
// Create a new empty list of points, and add some randomly
|
||||
List<Vector2> points = new List<Vector2>();
|
||||
for (int i = 0; i < numPoints; i++) {
|
||||
points.Add(
|
||||
new Vector2(
|
||||
Random.Range(-range.x, range.x),
|
||||
Random.Range(-range.y, range.y)));
|
||||
}
|
||||
|
||||
return points;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user