コード例 #1
0
 public Human(string surname, string name, string middlename, DateTime dateOfBirth, Genders gender, Educations education, double weight = 0, double height = 0, string adress = null, Human mother = null, Human father = null)
 {
     Id          = numberOfId++;
     Name        = name;
     Surname     = surname;
     Middlename  = middlename;
     DateOfBirth = dateOfBirth;
     Gender      = gender;
     Education   = education;
     Weight      = weight;
     Height      = height;
     Adress      = adress;
     Mother      = mother;
     Father      = father;
     IsHappy     = true;
     Partner     = null;
     if (Mother != null)
     {
         Mother.AddChild(this);
     }
     if (Father != null)
     {
         Father.AddChild(this);
     }
 }
コード例 #2
0
    static void Main(string[] args)
    {
        Mother mother = new Mother {
            FirstName = "M First", LastName = "M Last", Contact = "225632655"
        };

        //Add dependents
        mother.AddChild(new Child {
            ChildID = 1, FirstName = "Child FirstName 1", LastName = "Child LastName 1"
        });
        mother.AddChild(new Child {
            ChildID = 2, FirstName = "Child FirstName 2", LastName = "Child LastName 2"
        });
        mother.AddChild(new Child {
            ChildID = 3, FirstName = "Child FirstName 3", LastName = "Child LastName 3"
        });
        Console.WriteLine(mother);
        //List all the mother dependents
        foreach (Child c in mother.Children)
        {
            Console.WriteLine(c);
        }
        Console.ReadKey();
    }
コード例 #3
0
ファイル: Human.cs プロジェクト: XoTaBuCh/C-sharp
 public Human(string fullName, string identifier, bool isMale,
              DateTime dateOfBirth, Human mother, Human father)
 {
     FullName    = fullName;
     Identifier  = identifier;
     Gender      = Genders.Male;
     DateOfBirth = dateOfBirth;
     Mother      = mother;
     Father      = father;
     if (Mother != null)
     {
         Mother.AddChild(this);
     }
     if (Father != null)
     {
         Father.AddChild(this);
     }
 }
コード例 #4
0
ファイル: CK2Character.cs プロジェクト: Dinglydell/CK2Helper
 public void PostInitialise()
 {
     if (Mother != null)
     {
         Mother.AddChild(this);
     }
     if (Father != null)
     {
         Father.AddChild(this);
     }
     if (Religion == null)
     {
         Religion = Capital?.Province?.Religion ?? (DynastyID == 0 ? null : World.CK2Dynasties[DynastyID].Religion);
     }
     if (Culture == null)
     {
         Culture = Capital?.Province?.Culture ?? (DynastyID == 0 ? null : World.CK2Dynasties[DynastyID].Culture);
         if (ID == 1522394)
         {
             Console.WriteLine( );
         }
     }
 }