Пример #1
0
 /// <summary>
 ///Creates a reproduction with initial state.
 /// </summary>
 /// <param name="female">The female.</param>
 /// <param name="male">The male.</param>
 /// <param name="date">The date.</param>
 /// <param name="type">The type.</param>
 /// <param name="status">The status.</param>
 /// <param name="commentary">The commentary.</param>
 /// <returns></returns>
 public static Reproduction Initialize(Female female, Male male, DateTime date,
                                       ReproductionTypeEnum type, ReproductionStateEnum status,
                                       string commentary)
 {
     if (female != null && female.CanBeMated(date) && status == ReproductionStateEnum.Initial)
     {
         return(new Reproduction(female, male, date, type, ReproductionStateEnum.Initial, commentary));
     }
     return(Reproduction.None);
 }
Пример #2
0
 /// <summary>
 /// Initializes a new instance of the <see cref="Reproduction"/> class.
 /// </summary>
 /// <param name="female">The female.</param>
 /// <param name="male">The male.</param>
 /// <param name="date">The date.</param>
 /// <param name="type">The type.</param>
 /// <param name="status">The status.</param>
 /// <param name="commentary">The commentary.</param>
 private Reproduction(Female female, Male male, DateTime date,
                      ReproductionTypeEnum type, ReproductionStateEnum status,
                      string commentary)
 {
     if (female != null && female.CanBeMated(date) && status == ReproductionStateEnum.Initial)
     {
         Female = female;
         Male   = male;
         Date   = date;
         Type   = type;
         States.Append(new ReproductionState(status, date));
         Commentary = commentary;
     }
     else
     {
         Female = null;
         Male   = null;
         Date   = DateTime.MinValue;
         Type   = ReproductionTypeEnum.Artificial;
     }
 }