예제 #1
0
        internal void CalculateInfluences()
        {
            var neighbours = IdentifyNeighbours(Neighbours, Influences.Alignment.Range);
            var flockBoids = neighbours as IFlockBoid[] ?? neighbours.ToArray();
            var alignment  = new FlockInfluence(CalculateFlockAlignment(flockBoids), Influences.Alignment.Range, Influences.Alignment.Weight);
            var cohesion   = new FlockInfluence(CalculateFlockCohesion(flockBoids), Influences.Cohesion.Range, Influences.Cohesion.Weight);
            var separation = new FlockInfluence(CalculateFlockSeparation(flockBoids), Influences.Separation.Range, Influences.Separation.Weight);

            Influences = new FlockInfluences(alignment, cohesion, separation);
        }
예제 #2
0
 public FlockBoid(FlockInfluences influences, float maxSpeed, Vector3 position)
 {
     Influences = influences;
     MaxSpeed   = maxSpeed;
     Position   = position;
 }