Пример #1
0
 private void VerifyUnits(GameDef gameDef)
 {
     ValidateAllUnique(gameDef.Units.Select(x => x.Id.Id), "Units");
     foreach (var unit in gameDef.Units)
     {
         gameDef.ValidatePlayerType(unit.PlayerTypeRestriction, unit.Id.Id + " PlayerTypeRestriction");
         if (unit.Prerequisites.Count == 0)
         {
             throw new InvalidGameDefException($"Unit '{unit.Id}' has no prerequisites. At least one prerequisite is required.");
         }
         unit.Prerequisites.ForEach(x => gameDef.ValidateAssetDefId(x, unit.Id.Id + " Prerequisites"));
         gameDef.ValidateCost(unit.Cost, unit.Id.Id + " Cost");
     }
 }
Пример #2
0
 private void VerifyResources(GameDef gameDef)
 {
     ValidateAllUnique(gameDef.Resources.Select(x => x.Id.Id), "Resources");
     gameDef.ValidateResourceDefId(gameDef.ScoreResource, "ScoreResource");
 }
Пример #3
0
 public void Verify(GameDef gameDef)
 {
     VerifyUnits(gameDef);
     VerifyAssets(gameDef);
     VerifyResources(gameDef);
 }