/// <summary> /// HAVE A CHILLEN /// </summary> public void PopOneOut() { //if (Spouse != null) // Only have one if we're married :) //{ int gender = Utility.GetRandomGender(); if (gender == Person.GENDER_MALE) // Add a boy { Man child = new Man(this.world, this.Spouse, this) { Name = Utility.GetRandomName(Person.GENDER_MALE, this.GetLastName()) }; this.Children.Add(child); this.world.AddPerson(child); } else // Add a girl { Woman child = new Woman(this.world, this.Spouse, this) { Name = Utility.GetRandomName(Person.GENDER_FEMALE, this.GetLastName()) }; this.Children.Add(child); this.world.AddPerson(child); } //} }
/* Internal instance variables */ /// <summary> /// Public constructor /// </summary> /// <param name="w">World to be inserted into</param> /// <param name="dad">Father of this person</param> /// <param name="mom">Mother of this person</param> public Person(World w, Man dad, Woman mom) { this.ID = w.GetNewID(); this.world = w; this.Dad = dad; this.Mom = mom; }
/// <summary> /// Marry two people /// </summary> /// <param name="man">Husband</param> /// <param name="woman">Wife</param> public static void Marry(Man man, Woman woman) { man.Spouse = woman; woman.Spouse = man; woman.SetLastName(man.GetLastName()); man.Children = woman.Children; }
/// <summary> /// Public constructor /// </summary> /// <param name="regions">Number of Regions</param> /// /// <param name="rootCouples">Number of root couples to create</param> public World(int regions, int rootCouples) { for (int i = 0; i < rootCouples; i++) { Man man = new Man(this, null, null) { Name = Utility.GetRandomName(Person.GENDER_MALE) }; Woman woman = new Woman(this, null, null) { Name = Utility.GetRandomName(Person.GENDER_FEMALE) }; Person.Marry(man, woman); AddPerson(man); AddPerson(woman); } }
public Man(World w, Man dad, Woman mom) : base(w, dad, mom) { // }
public Woman(World w, Man dad, Woman mom) : base(w, dad, mom) { Gender = GENDER_FEMALE; }