private bool playerHasUnit(Player.Player player, UnitStats ustats) { List<Entity> entities = player.getEntities(); foreach (Entity e in entities) { if (e.entityType == Entity.EntityType.Unit) { Unit u = (Unit)e; if (u.stats.type == ustats.type) { return true; } } } return false; }
private bool playerHasBuilding(Player.Player player, BuildingStats bstats) { List<Entity> entities = player.getEntities(); foreach (Entity e in entities) { if (e.entityType == Entity.EntityType.Building) { Building b = (Building)e; if (b.stats.buildingType == bstats.buildingType) { return true; } } } return false; }