Esempio n. 1
0
    /// <summary>
    /// Constructor for adults, those who may enter the town or are settlers
    /// string nameAtBirth can be an empty string. the constructor will assign a randomly generated name.
    /// </summary>
    public Person(string name, List <Person> currSiblings, int age, Person sigOther, List <Person> children, Person[] parents, bool biologicalSex,
                  bool attractedToMen, bool attractedToWomen)
    {
        this.DateOfBirth           = Simulator.CurrentTime.AddYears(-age);
        this.age                   = age;
        this.sigOther              = sigOther;
        this.siblings              = currSiblings;
        this.children              = children;
        this.parents               = parents;
        this.biologicalSex         = biologicalSex;
        this.attractedToMen        = attractedToMen;
        this.attractedToWomen      = attractedToWomen;
        this.individualPersonality = new Personality();
        this.id = Guid.NewGuid();
        this.currentInstitution = InstitutionManager.RandomInstitution();  // random institution
        string[] nameSplit = name.Split(' ');

        this.firstName = (name.Length != 0) ? nameSplit[0] : GenerateRandomFirstName();
        this.lastName  = (nameSplit.Length > 1) ? nameSplit[1] : GenerateRandomLastName();
    }