public static bool AllEmpty(this IMapView <IGameObject> map, IEnumerable <Coord> area) { foreach (Coord pos in area) { if (!map.Contains(pos) || map[pos] != null) { return(false); } } return(true); }
private void ModifyLight(Light light, bool add) { //HashSet<Coord> litSpaces = new HashSet<Coord>(); if (!_transparencyMap.Contains(light.Pos)) { return; } FOV litFov = new FOV(_transparencyMap); litFov.Calculate(light.Pos, light.Range); IEnumerable <Coord> litSpaces = litFov.CurrentFOV; foreach (Coord litSpace in litSpaces) { //double falloff = litFov[litSpace]; double dist = Distance.EUCLIDEAN.Calculate(litSpace, light.Pos); double sqrDist = Math.Max(dist, .1);; //Math.Max(dist * dist, .1); if (!map.Contains(litSpace)) { continue; } if (add) { map[litSpace].Add(Brightness(light.Color, (int)(light.Brightness - sqrDist))); } else { map[litSpace].Subtract(Brightness(light.Color, (int)(light.Brightness - sqrDist))); } } }