예제 #1
0
    // 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);
        }
    }
예제 #2
0
        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);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
    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();
    }