public IEnumerable <IFlockBoid> UpdateNeighbourList(IEnumerable <IFlockBoid> neighbours = null) { if (neighbours != null) { Neighbours.UnionWith(neighbours); } var maxInfluenceRange = Mathf.Max(Influences.Alignment.Range, Influences.Cohesion.Range, Influences.Separation.Range); Neighbours.RemoveWhere(n => (n.Position - Position).magnitude > maxInfluenceRange); return(Neighbours); }
// Methods public void GetNeighbours() { Vertices.ForEach(a => Neighbours.UnionWith(a.GetAdjacentFaces(this))); }