public Village(VillageStartup startup, ServerCallContext context)
 {
     _context = context;
     _startup = startup;
     _year    = 346;
     _month   = 1;
     _status  = new VillageStatus
     {
         Time    = "",
         People  = _startup.People,
         Message = ""
     };
     _villagers = new List <Villager>();
     for (int i = 0; i < startup.People; i++)
     {
         _villagers.Add(new Villager
         {
             IsMale     = _r.Next(1) == 1,
             IsPregnant = false,
             Age        = _r.Next(30),
             MonthBorn  = _r.Next(1, 12)
         });
     }
 }
Exemple #2
0
 public override async Task StartVillage(VillageStartup villageStartup, IServerStreamWriter <VillageStatus> responseStream, ServerCallContext context)
 {
     var village = new Village(villageStartup, context);
     await village.Run(responseStream);
 }