diff --git a/Assets/Boid.cs b/Assets/Boid.cs new file mode 100644 index 0000000..4af27a8 --- /dev/null +++ b/Assets/Boid.cs @@ -0,0 +1,30 @@ +using System.Collections; +using System.Collections.Generic; +using UnityEngine; +public class Boid { + private Vector2 _position; + private Vector2 _velocity; + + // Renders the Boid. If focused, the + void Render(bool focused = false) { + + } + + // Returns the next position the Boid will be moving to + Vector2 NextPosition(List boids, float[] magnitudes) { + + } + + // Cohesion: Steer towards center of mass of flock + Vector2 Rule1(List flock) { + + } + + List GetFlock(List boids, float radius) { + List flock = new List(); + foreach(Boid boid in boids) + if(Vector2.Distance(this._position, boid._position) <= radius) + flock.Add(boid); + return flock; + } +} diff --git a/Assets/Boid.cs.meta b/Assets/Boid.cs.meta new file mode 100644 index 0000000..b08e4ca --- /dev/null +++ b/Assets/Boid.cs.meta @@ -0,0 +1,3 @@ +fileFormatVersion: 2 +guid: 8fa9bbc6d9eb4c368be190feba139e7c +timeCreated: 1589638836 \ No newline at end of file diff --git a/Assets/BoidController.cs b/Assets/BoidController.cs index ab71497..8a7f6bb 100644 --- a/Assets/BoidController.cs +++ b/Assets/BoidController.cs @@ -1,21 +1,26 @@ using System.Collections; using System.Collections.Generic; using UnityEngine; -using Unity.Mathematics; -using KNN; -using KNN.Jobs; public class BoidController : MonoBehaviour { - public int BoidCount = 1000; - public int BoidGroupRange = 1.0f; - - // Start is called before the first frame update - void Start() - { + // Controller Attributes + public Rect space; + + // Swarm Attributes + public int boidCount = 1000; + public float boidGroupRange = 1.0f; + + // Bias changes how different rules influence individual Boids more or less + public float separationBias = 1.0f; + public float alignmentBias = 1.0f; + public float cohesionBias = 1.0f; + + private List _boids = new List(); + + void Start() { } - // Update is called once per frame void Update() {