Exemple #1
0
	public static List<UnitTB> GetHostileInRangeFromTile(Tile srcTile, UnitTB srcUnit, bool visibleOnly){
		int unitMinRange=srcUnit.GetUnitAttackRangeMin();
		int unitMaxRange=srcUnit.GetUnitAttackRangeMax();
		List<Tile> tilesInRange=GridManager.GetTilesWithinRange(srcTile, unitMinRange, unitMaxRange);
		
		List<UnitTB> hostilesList=new List<UnitTB>();
		
		for(int i=0; i<tilesInRange.Count; i++){
			if(tilesInRange[i].unit!=null && tilesInRange[i].unit.factionID!=srcUnit.factionID){
				if(visibleOnly){
					if(GridManager.IsInLOS(srcTile, tilesInRange[i])){
						hostilesList.Add(tilesInRange[i].unit);
					}
				}
				else{
					hostilesList.Add(tilesInRange[i].unit);
				}
			}
		}
		
		return hostilesList;
	}