Пример #1
0
    /// <summary>
    /// Basic Constructor for newborns, takes in string nameAtBirth, and list of current siblings
    /// string nameAtBirth can be an empty string. the constructor will assign a randomly generated name.
    /// </summary>
    public Person(string nameAtBirth, List <Person> currSiblings)
    {
        DateOfBirth           = Simulator.CurrentTime;
        age                   = 0;
        sigOther              = null;
        siblings              = new List <Person>();
        children              = null;
        parents               = new Person[2];
        id                    = Guid.NewGuid();
        individualPersonality = new Personality();

        //Likely location for a baby should be a home, but this is temp.  It should likely be the home location of the parents in the future.
        currentInstitution = InstitutionManager.RandomInstitutionIfAny();  // Unfinalized method name for random institution
        if (Random.Integer(0, 2) == 1)
        {
            biologicalSex = true;
        }
        else
        {
            biologicalSex = false;
        }
        setSexuality(biologicalSex, Random.Float(0, 1));


        if (currSiblings != null)
        {
            foreach (Person p in currSiblings)
            {
                siblings.Add(p);
            }
        }
        string[] nameSplit = nameAtBirth.Split(' ');
        this.firstName = (nameAtBirth.Length != 0) ? nameSplit[0] : GenerateRandomFirstName();
        this.lastName  = (nameSplit.Length > 1) ? nameSplit[1] : GenerateRandomLastName();
    }
Пример #2
0
    /// -----------------------------------------------------------------------------------------------------------------------------///
    /// -----------------------------------------------------------------------------------------------------------------------------///
    /// <summary>
    /// Interface function to generate a person with randomly properties
    /// </summary>
    public static Person generateRandomPerson()
    {
        Person p = new Person("", null, new Person[2]);

        p.biologicalSex = (Random.Integer(0, 2) == 1);
        p.setSexuality(p.biologicalSex, Random.Float(0, 1));
        p.age                = Random.Integer(0, 70);
        p.DateOfBirth        = Simulator.CurrentTime.AddYears(-p.age);
        p.firstName          = NameManager.getFirstname(p.biologicalSex ? NameManager.sex.male : NameManager.sex.female);
        p.lastName           = NameManager.getSurname(null);
        p.currentInstitution = InstitutionManager.RandomInstitutionIfAny();
        return(p);
    }
Пример #3
0
    /// <summary>
    /// Basic Constructor for newborns, takes in string nameAtBirth, list of current siblings, and array of parents
    /// string nameAtBirth can be an empty string. the constructor will assign a randomly generated name.
    /// </summary>
    public Person(string nameAtBirth, List <Person> currSiblings, Person[] parentsParam)
    {
        DateOfBirth           = Simulator.CurrentTime;
        sigOther              = null;
        siblings              = new List <Person>();
        children              = null;
        parents               = parentsParam;
        individualPersonality = new Personality();
        id = Guid.NewGuid();

        /* keeps breaking
         * if(parentsParam[0].currentInstitution == null){
         *  currentInstitution = parentsParam[0].currentInstitution;
         * }
         * else {currentInstitution = InstitutionManager.RandomInstitutionIfAny();}
         */
        currentInstitution = InstitutionManager.RandomInstitutionIfAny();
        if (Random.Integer(0, 2) == 1)
        {
            biologicalSex = true;
        }
        else
        {
            biologicalSex = false;
        }
        setSexuality(biologicalSex, Random.Float(0, 1));

        if (currSiblings != null)
        {
            foreach (Person p in currSiblings)
            {
                siblings.Add(p);
            }
        }
        string[] nameSplit = nameAtBirth.Split(' ');
        this.firstName = (nameAtBirth.Length != 0) ? nameSplit[0] : GenerateRandomFirstName();
        this.lastName  = (nameSplit.Length > 1) ? nameSplit[1] : GenerateRandomLastName();
    }