private void CalculateMove(Boid boid) { Vector3 cohesionVector, separationVector, alignmentVector, seekVector, arriveVector; // calculate behaviours cohesionVector = Cohesion.CalculateCohesion(boid) * cohesionWeight; separationVector = Separation.CalculateSeparation(boid) * separationWeight; alignmentVector = Alignment.CalculateAlignment(boid) * alignmentWeight; seekVector = Seek.CalculateSeek(boid, Target, maxSpeed) * seekWeight; arriveVector = Arrive.CalculateArrive(boid, Target, arriveSlowingDistance, arriveMaxSpeed); // calculate vector var newVelocity = boid.Velocity + cohesionVector + separationVector + alignmentVector + seekVector + arriveVector; var newPosition = boid.Position + newVelocity; // limit newVelocity = LimitVelocity(newVelocity); boid.UpdateMove(newPosition, newVelocity); }