// will be called on each new Brain after it's created,
 // before asking for the first command
 public void SetRules(AiProtocol.GameRules gameRules)
 {
     // the time at which the rules were generated is a good way to determine if
     // the game was restarted, with possibly different rules
     if (rules.TimeWhenGenerated != gameRules.TimeWhenGenerated)
     {
         rules = gameRules;
         // DESTROY THE OLD HIVE
         // AND EVERYTHING WE HOLD STATIC
         Restart();
     }
 }
Example #2
0
 void GenerateRules()
 {
     AiProtocol.VillageRules redRules = new AiProtocol.VillageRules()
     {
         FoodPerChild     = Config.RedFoodPerChild,
         FoodPerLevel     = Config.RedFoodPerLevel,
         WoodPerLevel     = Config.RedWoodPerLevel,
         HighAgility      = Config.RedHighAgility,
         LowAgility       = Config.RedLowAgility,
         HighIntelligence = Config.RedHighIntelligence,
         LowIntelligence  = Config.RedLowIntelligence,
         HighStrength     = Config.RedHighStrength,
         LowStrength      = Config.RedLowStrength,
         ParentsRequired  = Config.RedParentsRequired
     };
     AiProtocol.VillageRules blueRules = new AiProtocol.VillageRules()
     {
         FoodPerChild     = Config.BlueFoodPerChild,
         FoodPerLevel     = Config.BlueFoodPerLevel,
         WoodPerLevel     = Config.BlueWoodPerLevel,
         HighAgility      = Config.BlueHighAgility,
         LowAgility       = Config.BlueLowAgility,
         HighIntelligence = Config.BlueHighIntelligence,
         LowIntelligence  = Config.BlueLowIntelligence,
         HighStrength     = Config.BlueHighStrength,
         LowStrength      = Config.BlueLowStrength,
         ParentsRequired  = Config.BlueParentsRequired
     };
     Rules = new AiProtocol.GameRules()
     {
         RedVillageRules        = redRules,
         BlueVillageRules       = blueRules,
         TimeWhenGenerated      = Time.unscaledTime + 1,
         MaxHearingDistance     = Config.MaxHearingDistance,
         MaxInteractionDistance = Config.MaxInteractionDistance,
         TreeRegrowingTime      = Config.TreeRegrowingTime,
         WalkingWindowSize      = Config.WalkingWindowSize
     };
 }
Example #3
0
 public void SetRules(AiProtocol.GameRules rules)
 {
 }
Example #4
0
 public void SetRules(AiProtocol.GameRules rules)
 {
     Brain.SetRules(rules);
 }