示例#1
0
 public static void ValidatePlayerType(this GameDef gameDef, PlayerTypeDefId playerTypeDefId, string hint)
 {
     if (!gameDef.PlayerTypes.Any(x => x.Id.Equals(playerTypeDefId)))
     {
         throw new InvalidGameDefException($"Player type '{playerTypeDefId}' not found. Check '{hint}'!");
     }
 }
示例#2
0
 public static IEnumerable <UnitDef> GetUnitsByPlayerType(this GameDef gameDef, PlayerTypeDefId playerTypeId)
 {
     return(gameDef.Units.Where(x => x.PlayerTypeRestriction.Equals(playerTypeId)));
 }