// Sets the position of all Boids public void SetFollowers() { // Delete the old formation and create a new one if (formation != null) { foreach (GameObject Point in formation) { Destroy(Point); } } formation = formationFunction.CreateFormation(size, spacing, true); // Set the positions for each Boid on the formation List <GameObject> tempBoids = new List <GameObject>(Boids); foreach (GameObject Point in formation) { Point.transform.SetParent(leader.transform, false); // Find the closest Boid GameObject closeBoid = null; float distance = Mathf.Infinity; foreach (GameObject Boid in tempBoids) { if (Vector2.Distance(Boid.transform.position, Point.transform.position) < distance) { distance = Vector2.Distance(Boid.transform.position, Point.transform.position); closeBoid = Boid; } } closeBoid.GetComponent <NPCController>().target = Point.GetComponent <NPCController>(); tempBoids.Remove(closeBoid); } }
public override GraphObject CreateGraphObject(ViewModel viewModel) { var certification = (CertificationViewModel)viewModel; var certificationModel = Formation.CreateFormation(certification.Annee, certification.Description, FormationType.Certification); formationGraphRepository.Add(certificationModel); return(certificationModel); }
public override GraphObject CreateGraphObject(ViewModel viewModel) { var conference = (ConferenceViewModel)viewModel; var conferenceModel = Formation.CreateFormation(conference.Annee, conference.Description, FormationType.Conference); formationGraphRepository.Add(conferenceModel); return(conferenceModel); }
public override GraphObject CreateGraphObject(ViewModel viewModel) { var perfectionnement = (PerfectionnementViewModel)viewModel; var PerfectionnementModel = Formation.CreateFormation(perfectionnement.Annee, perfectionnement.Description, FormationType.Perfectionnement); formationGraphRepository.Add(PerfectionnementModel); return(PerfectionnementModel); }
private void UpdateFormation(Vector3 formationPosition, Vector3 formationLookDirection) //creates the formation { //formation = new Formation(selectionGroup.Count); formation.CreateFormation(selectionGroup.Count, formationPosition, formationLookDirection); //formation.transform.position = formationPosition; //formation.transform.rotation = Quaternion.LookRotation(formationLookDirection); //formation.DrawFormation(); }