public IList <Terrain> GetTerrainsInRadius(HexCoord coord, int radius) { var result = new List <Terrain>(); foreach (var terra in Map) { var distance = coord.WorldDistance(terra.Coord); if (distance <= radius * HexCoord.Y_SHIFT * 2 + 0.01) { result.Add(terra); } } return(result); }
public float WorldDistance(HexCoord other) { return(Mathf.Sqrt(Mathf.Pow(WorldX - other.WorldX, 2f) + Mathf.Pow(WorldY - other.WorldY, 2f))); }