コード例 #1
0
        /// <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);
            }
            //}
        }
コード例 #2
0
        /* 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;
        }
コード例 #3
0
        /// <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;
        }
コード例 #4
0
        /// <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);
            }
        }
コード例 #5
0
ファイル: Man.cs プロジェクト: crocboy/Helix
 public Man(World w, Man dad, Woman mom) : base(w, dad, mom)
 {
     //
 }
コード例 #6
0
 public Woman(World w, Man dad, Woman mom) : base(w, dad, mom)
 {
     Gender = GENDER_FEMALE;
 }